您可以使用' describe pod '语法
对于OpenShift,请使用:
oc describe pod <pod-id>
对于香草Kubernetes:
kubectl describe pod <pod-id>
检查输出事件。在我的情况下,它显示了退避拉图像coredns / coredns:latest
在这种情况下,映像coredns / coredns:latest无法从Internet提取。
Events:
FirstSeen LastSeen Count From SubObjectPath Type Reason Message
--------- -------- ----- ---- ------------- -------- ------ -------
5m 5m 1 {default-scheduler } Normal Scheduled Successfully assigned coredns-4224169331-9nhxj to 192.168.122.190
5m 1m 4 {kubelet 192.168.122.190} spec.containers{coredns} Normal Pulling pulling image "coredns/coredns:latest"
4m 26s 4 {kubelet 192.168.122.190} spec.containers{coredns} Warning Failed Failed to pull image "coredns/coredns:latest": Network timed out while trying to connect to https://index.docker.io/v1/repositories/coredns/coredns/images. You may want to check your internet connection or if you are behind a proxy.
4m 26s 4 {kubelet 192.168.122.190} Warning FailedSync Error syncing pod, skipping: failed to "StartContainer" for "coredns" with ErrImagePull: "Network timed out while trying to connect to https://index.docker.io/v1/repositories/coredns/coredns/images. You may want to check your Internet connection or if you are behind a proxy."
4m 2s 7 {kubelet 192.168.122.190} spec.containers{coredns} Normal BackOff Back-off pulling image "coredns/coredns:latest"
4m 2s 7 {kubelet 192.168.122.190} Warning FailedSync Error syncing pod, skipping: failed to "StartContainer" for "coredns" with ImagePullBackOff: "Back-off pulling image \"coredns/coredns:latest\""
其他调试步骤
- 尝试拉docker图像并在计算机上手动标记
- 通过执行“ kubectl / oc get pods -o wide”来识别节点
- ssh进入无法拉出docker映像的节点(如果可以)
- 通过执行ping检查节点是否可以解析docker注册表的DNS。
- 尝试在节点上手动拉docker镜像
- 如果您使用的是私人注册表,请检查您的机密是否存在并且该机密是否正确。您的机密也应位于同一名称空间中。谢谢swenzel
- 一些注册表具有限制IP地址访问的防火墙。防火墙可能会阻止拉动
- 一些配置项使用临时docker机密创建部署。因此,秘密会在几天后过期(您正在要求生产失败...)