I'm sporting a fresh Minikube install on an ArchLinux box, using Docker as the Minikube driver.
I started the minikube "cluster" using the minikube start
command. docker container ls
tells us it's up and running:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d86070af0c21 gcr.io/k8s-minikube/kicbase:v0.0.28 "/usr/local/bin/entr…" 50 minutes ago Up 50 minutes 127.0.0.1:49162->22/tcp, 127.0.0.1:49161->2376/tcp, 127.0.0.1:49160->5000/tcp, 127.0.0.1:49159->8443/tcp, 127.0.0.1:49158->32443/tcp minikube
I'm trying to run a simple nginx pod, using this command: kubectl run my-nginx --image nginx
Since I'm pulling a public image from a public repo, I would expect I don't need any authentication. But the describe pod
sub-command shows:
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 47s default-scheduler Successfully assigned default/my-nginx to minikube
Normal BackOff 31s kubelet Back-off pulling image "nginx"
Warning Failed 31s kubelet Error: ImagePullBackOff
Normal Pulling 19s (x2 over 46s) kubelet Pulling image "nginx"
Warning Failed 4s (x2 over 31s) kubelet Failed to pull image "nginx": rpc error: code = Unknown desc = Error response from daemon: Get "https://registry-1.docker.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
Warning Failed 4s (x2 over 31s) kubelet Error: ErrImagePull
When I try to curl the URL found in the error message from inside the minikube container, it shows that authentication is needed:
patres@arch:~$ minikube ssh
docker@minikube:~$ curl https://registry-1.docker.io/v2/
{"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":null}]}
When I try to pull that very image from host using docker pull nginx
command, the image gets pulled, no auth required.
I also tried to create a kubernetes secret this way, then launching the pod using YAML with that secret, but it was to no avail.
kubectl create secret docker-registry regcred --docker-server=https://registry-1.docker.io/v2/ --docker-username=myusername --docker-password=mypass --docker-email=my@email.com
Finally, it seems like the issue might not be unique to DockerHub, since if I follow
the official minikubes documentation and launch the default hello-minikube
deployment:
kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.4
I get the same ImagePullBackOff
error:
$ kubectl get pod hello-minikube-6ddfcc9757-zdzz2
NAME READY STATUS RESTARTS AGE
hello-minikube-6ddfcc9757-zdzz2 0/1 ImagePullBackOff 0 6m11s
The problem got resolved by one of these actions (not sure by which exactly):
minikube start