K8s pod ImagePullBackoff



创建了一个非常简单的nginx pod并运行到状态ImagePullBackoff

Events:
Type     Reason     Age                   From               Message
----     ------     ----                  ----               -------
Normal   Scheduled  32m                   default-scheduler  Successfully assigned reloader/nginx to aks-appnodepool1-22779252-vmss000000
Warning  Failed     29m                   kubelet            Failed to pull image "nginx": rpc error: code = Unknown desc = failed to pull and unpack image "docker.io/library/nginx:latest": failed to resolve reference "docker.io/library/nginx:latest": failed to do request: Head "https://registry-1.docker.io/v2/library/nginx/manifests/latest": dial tcp 52.200.78.26:443: i/o timeout
Warning  Failed     27m                   kubelet            Failed to pull image "nginx": rpc error: code = Unknown desc = failed to pull and unpack image "docker.io/library/nginx:latest": failed to resolve reference "docker.io/library/nginx:latest": failed to do request: Head "https://registry-1.docker.io/v2/library/nginx/manifests/latest": dial tcp 52.21.28.242:443: i/o timeout
Warning  Failed     23m                   kubelet            Failed to pull image "nginx": rpc error: code = Unknown desc = failed to pull and unpack image "docker.io/library/nginx:latest": failed to resolve reference "docker.io/library/nginx:latest": failed to do request: Head "https://registry-1.docker.io/v2/library/nginx/manifests/latest": dial tcp 3.223.210.206:443: i/o timeout
Normal   Pulling    22m (x4 over 32m)     kubelet            Pulling image "nginx"
Warning  Failed     20m (x4 over 29m)     kubelet            Error: ErrImagePull
Warning  Failed     20m                   kubelet            Failed to pull image "nginx": rpc error: code = Unknown desc = failed to pull and unpack image "docker.io/library/nginx:latest": failed to resolve reference "docker.io/library/nginx:latest": failed to do request: Head "https://registry-1.docker.io/v2/library/nginx/manifests/latest": dial tcp 3.228.155.36:443: i/o timeout
Warning  Failed     20m (x7 over 29m)     kubelet            Error: ImagePullBackOff
Warning  Failed     6m41s                 kubelet            Failed to pull image "nginx": rpc error: code = Unknown desc = failed to pull and unpack image "docker.io/library/nginx:latest": failed to resolve reference "docker.io/library/nginx:latest": failed to do request: Head "https://registry-1.docker.io/v2/library/nginx/manifests/latest": dial tcp 52.5.157.114:443: i/o timeout
Normal   BackOff    2m17s (x65 over 29m)  kubelet            Back-off pulling image "nginx"

已检查网络状态:

  • 同一子网中的VM可以访问";https://registry-1.docker.io/v2/library/nginx/manifests/latest"CCD_ 2成功
  • docker pull nginx在同一子网中的VM上成功
  • kubectl exec进入同一集群中运行的pod可以成功地wget https://registry-1.docker.io/v2/library/nginx/manifests/latest。。可能的问题是什么

当我wget/ccurl或任何你想访问的东西时

https://registry-1.docker.io/v2/library/nginx/manifests/latest

上面写着

{"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":[{"Type":"repository","Class":"","Name":"library/nginx","Action":"pull"}]}]}

但是,这是因为您需要登录才能从此存储库中提取此映像。

2种解决方案:

第一个很简单,在图像字段中,只需将此url替换为nginx:latest,它就可以使用

第二:创建regcred

在您的pod yaml中,将image : docker.io/library/nginx:latest更改为docker.io/nginx:latest

结果被防火墙丢弃了包。

最新更新