K8S日常运维中关于“ImagePullBackOff”报错的处理思路分析
故障案例:
发现故障:
kubectl get pod -n kube-system -owide|grep -v "Running"
NAME READY STATUS RESTARTS AGE IP NODE
pod-jljz6 0/1 ImagePullBackOff 0 4d 10.222.96.191 paasn5
查询pod详细信息
kubectl describe pod pod-jljz6 -n kube-system
....
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning Failed 6m(x30486 over 4d) kubelet, paasn5 Error: ImagePullBackOff
Normal BackOff 1m(x30486 over 4d) kubelet, paasn5 BackOff pulling image "registry.paas/cangku/pod_drl:v1"
切换至节点查看当前镜像发现确实没有该镜像
docker image ls
此时解决方案一:拉取镜像,发现连接失败
# docker pull registry.paas/cangku/pod_drl:v1
Error response from daemon: Get http://registry.paas/v2/: dial tcp 10.191.78.235:80: connect: connection refused
解决方案二:
检查master节点或其他节点是否有该镜像
docker image ls
如有将镜像导出,然后传送至节点后导入
# docker image save -o pod_drl.tar.gz registry.paas/cangku/pod_drl:v1
# scp pod_drl.tar.gz paasn5:/root/
切换至节点
# docker image load -i pod_drl.tar.gz
最后查询pod状态正常
kubectl get pod -n kube-system|grep "jljz6"