突然之间,我无法部署一些以前可以部署的图像。我得到了以下 pod 状态:
[root@webdev2 origin]# oc get pods NAME READY STATUS RESTARTS AGE arix-3-yjq9w 0/1 ImagePullBackOff 0 10m docker-registry-2-vqstm 1/1 Running 0 2d router-1-kvjxq 1/1 Running 0 2d
该应用程序将无法启动。pod 未尝试运行容器。从事件页面,我得到了Back-off pulling image "172.30.84.25:5000/default/arix@sha256:d326. 我已经验证我可以使用带有docker pull.
Back-off pulling image "172.30.84.25:5000/default/arix@sha256:d326
docker pull
我还检查了最后一个容器的日志。由于某种原因它被关闭了。我认为吊舱至少应该尝试重新启动它。
我已经没有办法调试这些问题了。我还能检查什么?
您可以使用 ‘ describe pod ‘ 语法
对于 OpenShift 使用:
oc describe pod <pod-id>
对于普通 Kubernetes:
kubectl describe pod <pod-id>
检查输出的事件。就我而言,它显示Back-off pulling image unreachableserver/nginx:1.14.22222
Back-off pulling image unreachableserver/nginx:1.14.22222
这种情况下unreachableserver/nginx:1.14.22222无法从网上拉取镜像,因为没有Docker registry unreachableserver,镜像nginx:1.14.22222也不存在。
unreachableserver/nginx:1.14.22222
nginx:1.14.22222
注意:如果您没有看到任何感兴趣的事件,并且 pod 已处于“ImagePullBackOff”状态一段时间(似乎超过 60 分钟),则需要删除该 pod 并查看新 pod 中的事件。
oc delete pod <pod-id> oc get pods oc get pod <new-pod-id>
kubectl delete pod <pod-id> kubectl get pods kubectl get pod <new-pod-id>
样本输出:
Type Reason Age From Message ---- ------ ---- ---- ------- Normal Scheduled 32s default-scheduler Successfully assigned rk/nginx-deployment-6c879b5f64-2xrmt to aks-agentpool-x Normal Pulling 17s (x2 over 30s) kubelet Pulling image "unreachableserver/nginx:1.14.22222" Warning Failed 16s (x2 over 29s) kubelet Failed to pull image "unreachableserver/nginx:1.14.22222": rpc error: code = Unknown desc = Error response from daemon: pull access denied for unreachableserver/nginx, repository does not exist or may require 'docker login': denied: requested access to the resource is denied Warning Failed 16s (x2 over 29s) kubelet Error: ErrImagePull Normal BackOff 5s (x2 over 28s) kubelet Back-off pulling image "unreachableserver/nginx:1.14.22222" Warning Failed 5s (x2 over 28s) kubelet Error: ImagePullBackOff
其他调试步骤