[英]kubectl fails at creating deployment from local image if the minikube started with more than 1 node
[英]Kubectl throws ImagePullBackOff Error while creating deployment via minikube
嘗試從映像創建部署
kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.10
然后使用kubectl get pods
並檢查 hello-minikube pod 的日志
kubectl pod describe <pod-name>
拋出以下錯誤
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
可以使用以下方法解決此錯誤:
通過docker-machine ls
檢查是否有任何 docker 機器正在運行
如果不存在機器,則使用docker-machine create <machine-name>
創建一docker-machine create <machine-name>
然后使用docker-machine ip <machine-name>
獲取這台機器IP
然后首先使用minikube delete
刪除任何現有的 minikube 集群,然后使用minikube start --vm-driver="virtualbox" --insecure-registry="docker-machine IP":80
然后運行kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.10
並檢查日志,它會顯示成功拉取圖像。
從事件來看,調用192.168.64.1:53
的 DNS 服務器來解析 k8s.gcr.io 似乎失敗了。 檢查是否有在該 IP 上運行的 DNS 服務器。 它可以在 minikube 主機上的/etc/resolv.conf
(如果是 Linux)中配置。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.