(1). kubectl apply -f xxx.yml之后,查看Pod显示:ImagePullBackOff
[root@master ~]# kubectl get pods
NAME READY STATUS RESTARTS AGE
hello-world-6b6d6fd479-d7tp4 0/1 ContainerCreating 0 5m48s
hello-world-6b6d6fd479-ksgbr 0/1 ContainerCreating 0 5m48s
hello-world-6b6d6fd479-zn85h 0/1 ImagePullBackOff 0 5m48s
(2). 查看资源详细信息
查看容器详细信息
[root@master ~]# kubectl describe pod hello-world-6b6d6fd479-zn85h
Name: hello-world-6b6d6fd479-zn85h
Namespace: default
Priority: 0
Node: node-2/10.211.55.102
Start Time: Tue, 12 Jan 2021 14:51:35 +0800
Labels: app=hello-world
pod-template-hash=6b6d6fd479
Annotations: <none>
Status: Pending
IP: 10.244.2.15
Controlled By: ReplicaSet/hello-world-6b6d6fd479
Containers:
hello:
Container ID:
Image: lixinhelp/hello:2.0.0-SNAPSHOT
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 default-token-9dkwx (ro)
Conditions:
Type Status
Initialized True
Ready False
ContainersReady False
PodScheduled True
Volumes:
default-token-9dkwx:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-9dkwx
Optional: false
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 8m34s default-scheduler Successfully assigned default/hello-world-6b6d6fd479-zn85h to node-2
Warning Failed 3m45s kubelet, node-2 Failed to pull image "lixinhelp/hello:2.0.0-SNAPSHOT": rpc error: code = Unknown desc = context canceled
Warning Failed 3m45s kubelet, node-2 Error: ErrImagePull
Normal BackOff 3m45s kubelet, node-2 Back-off pulling image "lixinhelp/hello:2.0.0-SNAPSHOT"
############################################ImagePullBackOff#####################################################
############################################在node-2拉取镜像失败###################################################
############################################自己手动去拉取镜即可###################################################
Warning Failed 3m45s kubelet, node-2 Error: ImagePullBackOff
Normal Pulling 3m34s (x2 over 8m33s) kubelet, node-2 Pulling image "lixinhelp/hello:2.0.0-SNAPSHOT"
查看容器日志
[root@master ~]# kubectl logs hello-world-6b6d6fd479-ksgbr
Error from server (BadRequest): container "hello" in pod "hello-world-6b6d6fd479-ksgbr" is waiting to start: trying and failing to pull image
(3). 总结
从上面的信息,在node-2节点拉取镜像失败.所以,可以手工去拉取镜像.(建议:自建私有仓库).