1

我在 macOS 上,我正在使用minikube驱动hyperkit程序:minikube start --driver=hyperkit

一切似乎都很好......

minikube status

minikube
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured

minikube version

minikube version: v1.24.0

kubectl version

Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.4", GitCommit:"b695d79d4f967c403a96986f1750a35eb75e75f1", GitTreeState:"clean", BuildDate:"2021-11-17T15:48:33Z", GoVersion:"go1.16.10", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.3", GitCommit:"c92036820499fedefec0f847e2054d824aea6cd1", GitTreeState:"clean", BuildDate:"2021-10-27T18:35:25Z", GoVersion:"go1.16.9", Compiler:"gc", Platform:"linux/amd64"}

并与kubectl get no

NAME       STATUS   ROLES                  AGE   VERSION
minikube   Ready    control-plane,master   13m   v1.22.3

我的问题是当我部署任何东西时,它不会拉任何图像......

例如:

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

然后kubectl get pods

NAME                              READY   STATUS             RESTARTS   AGE
hello-minikube-6ddfcc9757-nfc64   0/1     ImagePullBackOff   0          13m

然后我试图找出问题所在?

k describe pod/hello-minikube-6ddfcc9757-nfc64

结果如下:

Name:         hello-minikube-6ddfcc9757-nfc64
Namespace:    default
Priority:     0
Node:         minikube/192.168.64.8
Start Time:   Sun, 16 Jan 2022 10:49:27 +0330
Labels:       app=hello-minikube
              pod-template-hash=6ddfcc9757
Annotations:  <none>
Status:       Pending
IP:           172.17.0.5
IPs:
  IP:           172.17.0.5
Controlled By:  ReplicaSet/hello-minikube-6ddfcc9757
Containers:
  echoserver:
    Container ID:   
    Image:          k8s.gcr.io/echoserver:1.4
    Image ID:       
    Port:           <none>
    Host Port:      <none>
    State:          Waiting
      Reason:       ImagePullBackOff
    Ready:          False
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-k5qql (ro)
Conditions:
  Type              Status
  Initialized       True 
  Ready             False 
  ContainersReady   False 
  PodScheduled      True 
Volumes:
  kube-api-access-k5qql:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
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  18m                   default-scheduler  Successfully assigned default/hello-minikube-6ddfcc9757-nfc64 to minikube
  Normal   Pulling    16m (x4 over 18m)     kubelet            Pulling image "k8s.gcr.io/echoserver:1.4"
  Warning  Failed     16m (x4 over 18m)     kubelet            Failed to pull image "k8s.gcr.io/echoserver:1.4": rpc error: code = Unknown desc = Error response from daemon: Get "https://k8s.gcr.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
  Warning  Failed     16m (x4 over 18m)     kubelet            Error: ErrImagePull
  Warning  Failed     15m (x6 over 18m)     kubelet            Error: ImagePullBackOff
  Normal   BackOff    3m34s (x59 over 18m)  kubelet            Back-off pulling image "k8s.gcr.io/echoserver:1.4"

然后尝试获取一些日志!:

k logs pod/hello-minikube-6ddfcc9757-nfc64k logs deploy/hello-minikube

两者都返回相同的结果:

Error from server (BadRequest): container "echoserver" in pod "hello-minikube-6ddfcc9757-nfc64" is waiting to start: trying and failing to pull image

此部署是minikube 文档中的一个示例

但我不知道为什么它不拉任何图像......

4

1 回答 1

0

根据这篇文章

该状态 ImagePullBackOff 表示 Pod 无法启动,因为 Kubernetes 无法拉取容器镜像。“BackOff”部分意味着 Kubernetes 将继续尝试拉取镜像,延迟增加(“back-off”)。

也是一本关于将图像推送到 minikube 集群的手册。

本手册描述了您的问题:

无法提取图像..Client.Timeout 在等待标头时超出

Unable to pull images, which may be OK:

failed to pull image "k8s.gcr.io/kube-apiserver:v1.13.3": output: Error response from daemon:
Get https://k8s.gcr.io/v2/: net/http: request canceled while waiting for connection
(Client.Timeout exceeded while awaiting headers)

此错误表示在 VM 中运行的容器运行时无法访问 Internet。

查看可能的解决方法

于 2022-01-27T01:56:47.570 回答