snowdrop/k8s-infra

New kind script generates such an error: http: server gave HTTP response to HTTPS client

cmoulliard opened this issue · 0 comments

Issue

The new kind bash script (like also the old kind-reg-ingress.sh) generates such an error http: server gave HTTP response to HTTPS client when a pod is created

Steps to reproduce and investigate

rm -rf ~/.docker/certs.d/kind-registry:5000
curl -s -L "https://raw.githubusercontent.com/snowdrop/k8s-infra/main/kind/kind.sh" | bash -s install --delete-kind-cluster

docker pull gcr.io/google-samples/hello-app:1.0
docker tag gcr.io/google-samples/hello-app:1.0 kind-registry:5000/hello-app:1.0
docker push kind-registry:5000/hello-app:1.0

docker exec -it kind-control-plane crictl info
docker exec -it kind-control-plane bash -c "crictl -r unix:///var/run/containerd/containerd.sock pull kind-registry:5000/hello-app:1.0"

kubectl create deployment hello --image=kind-registry:5000/hello-app:1.0
kubectl describe pod -l app=hello

The problem is due to the fact that the existing containerd config uses as mirror localhost:5000 instead of kind-registry:5000

  [plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:${REGISTRY_PORT}"]
    endpoint = ["http://${REGISTRY_NAME}:${REGISTRY_PORT}"]

-->

  [plugins."io.containerd.grpc.v1.cri".registry.mirrors."${REGISTRY_NAME}:${REGISTRY_PORT}"]
    endpoint = ["http://${REGISTRY_NAME}:${REGISTRY_PORT}"]