Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kubectl throws ImagePullBackOff Error while creating deployment via minikube

Trying to create a deployment from an image

kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.10

and then do kubectl get pods and check the logs of hello-minikube pod using

kubectl pod describe <pod-name> throws following error

  Type     Reason     Age                From               Message
  ----     ------     ----               ----               -------
  Normal   Scheduled  <unknown>          default-scheduler  Successfully assigned default/hello-minikube-797f975945-dmq26 to minikube
  Warning  Failed     42s                kubelet, minikube  Failed to pull image "k8s.gcr.io/echoserver:1.10": rpc error: code = Unknown desc = Error response from daemon: Get https://k8s.gcr.io/v2/: dial tcp: lookup k8s.gcr.io on 192.168.64.1:53: read udp 192.168.64.3:56747->192.168.64.1:53: read: connection refused
  Warning  Failed     27s                kubelet, minikube  Failed to pull image "k8s.gcr.io/echoserver:1.10": rpc error: code = Unknown desc = Error response from daemon: Get https://k8s.gcr.io/v2/: dial tcp: lookup k8s.gcr.io on 192.168.64.1:53: read udp 192.168.64.3:48279->192.168.64.1:53: read: connection refused
  Normal   BackOff    16s (x2 over 42s)  kubelet, minikube  Back-off pulling image "k8s.gcr.io/echoserver:1.10"
  Warning  Failed     16s (x2 over 42s)  kubelet, minikube  Error: ImagePullBackOff
  Normal   Pulling    4s (x3 over 42s)   kubelet, minikube  Pulling image "k8s.gcr.io/echoserver:1.10"
  Warning  Failed     4s (x3 over 42s)   kubelet, minikube  Error: ErrImagePull
  Warning  Failed     4s                 kubelet, minikube  Failed to pull image "k8s.gcr.io/echoserver:1.10": rpc error: code = Unknown desc = Error response from daemon: Get https://k8s.gcr.io/v2/: dial tcp: lookup k8s.gcr.io on 192.168.64.1:53: read udp 192.168.64.3:50616->192.168.64.1:53: read: connection refused
like image 892
Shivani Singhal Avatar asked Oct 15 '22 08:10

Shivani Singhal


2 Answers

This error can be solved using :

  1. Check whether any docker machine is running or not by docker-machine ls

  2. If no machine exist, then create one using docker-machine create <machine-name>

  3. Then get this machine IP using docker-machine ip <machine-name>

  4. Then first delete any existing minikube cluster using minikube delete and start again using minikube start --vm-driver="virtualbox" --insecure-registry="docker-machine IP":80

  5. Then run kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.10 and check the logs, it will show image pulled successfully.

like image 148
Shivani Singhal Avatar answered Oct 23 '22 19:10

Shivani Singhal


From the events it looks like the call to a DNS server at 192.168.64.1:53 to resolve k8s.gcr.io is failing. Check if there's a DNS server running at that IP. It may be configured in /etc/resolv.conf (if Linux) on the minikube host.

like image 1
gears Avatar answered Oct 23 '22 20:10

gears