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
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.
This error can be solved using :
Check whether any docker machine is running or not by docker-machine ls
If no machine exist, then create one using docker-machine create <machine-name>
Then get this machine IP using docker-machine ip <machine-name>
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
Then run kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.10
and check the logs, it will show image pulled successfully.