简体   繁体   中英

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

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM