首页 > 解决方案 > Windows 10 上的 minikube 无法获取:ImagePullBackOff

问题描述

我尝试使用以下命令在 minikube 中安装简单的 ping pod:

kubectl run pingpong --image alpine ping 1.1.1.1

但是当我检查 kubectl get pods 时,我得到了:

NAME       READY   STATUS             RESTARTS   AGE
pingpong   0/1     ImagePullBackOff   0          3m1s
 

然后我检查问题:kubectl describe pod/pingpong:

Name:         pingpong
Namespace:    default
Priority:     0
Node:         minikube/172.29.72.76
Start Time:   Wed, 07 Jul 2021 11:24:33 +0300
Labels:       run=pingpong
Annotations:  <none>
Status:       Pending
IP:           17x.xx.0.x
IPs:
  IP:  17x.xx.0.x
Containers:
  pingpong:
    Container ID:
    Image:         alpine
    Image ID:
    Port:          <none>
    Host Port:     <none>
    Args:
      ping
      1.1.1.1
    State:          Waiting
      Reason:       ImagePullBackOff
    Ready:          False
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-4c47j (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  default-token-4c47j:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-4c47j
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                 node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason     Age                From               Message
  ----     ------     ----               ----               -------
  Normal   Scheduled  82s                default-scheduler  Successfully assigned default/pingpong to minikube
  Warning  Failed     72s                kubelet            Failed to pull image "alpine": rpc error: code = Unknown desc = Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 172.29.64.1:53: read udp 172.29.72.76:50215->172.29.64.1:53: i/o timeout
  Warning  Failed     41s                kubelet            Failed to pull image "alpine": 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)
  Normal   BackOff    26s (x2 over 71s)  kubelet            Back-off pulling image "alpine"
  Warning  Failed     26s (x2 over 71s)  kubelet            Error: ImagePullBackOff
  Normal   Pulling    15s (x3 over 82s)  kubelet            Pulling image "alpine"
  Warning  Failed     5s (x3 over 72s)   kubelet            Error: ErrImagePull
  Warning  Failed     5s                 kubelet            Failed to pull image "alpine": rpc error: code = Unknown desc = Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 172.29.64.1:53: read udp 172.29.72.76:41780->172.29.64.1:53: i/o timeout

但是当我测试 minikube 时:

C:\WINDOWS\system32> minikube ssh -- ping -c 4 kubernetes.io

我得到 ping :

PING kubernetes.io (147.75.40.148): 56 data bytes
64 bytes from 147.75.40.148: seq=0 ttl=52 time=86.712 ms
64 bytes from 147.75.40.148: seq=1 ttl=52 time=85.379 ms
64 bytes from 147.75.40.148: seq=2 ttl=52 time=86.172 ms
64 bytes from 147.75.40.148: seq=3 ttl=52 time=87.001 ms

--- kubernetes.io ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 85.379/86.316/87.001 ms

还 :

$ kubectl describe deploy/coredns -n kube-system
Name:                   coredns
Namespace:              kube-system
CreationTimestamp:      Wed, 07 Jul 2021 11:21:13 +0300
Labels:                 k8s-app=kube-dns
Annotations:            deployment.kubernetes.io/revision: 1
Selector:               k8s-app=kube-dns
Replicas:               1 desired | 1 updated | 1 total | 1 available | 0 unavailable
StrategyType:           RollingUpdate
MinReadySeconds:        0
RollingUpdateStrategy:  1 max unavailable, 25% max surge
Pod Template:
  Labels:           k8s-app=kube-dns
  Service Account:  coredns
  Containers:
   coredns:
    Image:       k8s.gcr.io/coredns:1.7.0
    Ports:       53/UDP, 53/TCP, 9153/TCP
    Host Ports:  0/UDP, 0/TCP, 0/TCP
    Args:
      -conf
      /etc/coredns/Corefile
    Limits:
      memory:  170Mi
    Requests:
      cpu:        100m
      memory:     70Mi
    Liveness:     http-get http://:8080/health delay=60s timeout=5s period=10s #success=1 #failure=5
    Readiness:    http-get http://:8181/ready delay=0s timeout=1s period=10s #success=1 #failure=3
    Environment:  <none>
    Mounts:
      /etc/coredns from config-volume (ro)
  Volumes:
   config-volume:
    Type:               ConfigMap (a volume populated by a ConfigMap)
    Name:               coredns
    Optional:           false
  Priority Class Name:  system-cluster-critical
Conditions:
  Type           Status  Reason
  ----           ------  ------
  Available      True    MinimumReplicasAvailable
  Progressing    True    NewReplicaSetAvailable
OldReplicaSets:  <none>
NewReplicaSet:   coredns-74ff55c5b (1/1 replicas created)
Events:
  Type    Reason             Age   From                   Message
  ----    ------             ----  ----                   -------
  Normal  ScalingReplicaSet  11m   deployment-controller  Scaled up replica set coredns-74ff55c5b to 1

我在这里做错了什么?

标签: kubernetesnetworkingwindows-10minikube

解决方案


推荐阅读