https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/

1、Pod phase

value for pod phase

Pending

集群已接收请求,未调度到node节点。node资源,硬盘pressure IO cpu memory

Running

1/1 running 已经ready,程序已要以pod内正常运行

Succeeded

Pod terminated from node

ContainerStatusUnknown

无法获知pod状态,失联状态。

Failed

All containers in the Pod have terminated, and at least one container has terminated in failure. That is, the container either exited with non-zero status or was terminated by the system

CrashLoopBackOff

挂掉


Pod ContainerStatusUnknown 状态

pod Lifecycle 及 pod 异常状态处理_pod异常、ContainerStatu

pod失连无法受管控,直接强制删除 --force
delete pods xxxx --force -n xxxx 强制删除即可
2、还有一种情况,是pod所在机器cpu打满,pod是terminating状态。实际上pod也是已经失联
查看日志如下:
kubelet, \ error killing pod: [failed to "KillContainer" for "xxx" with KillContainerError:

使用--force 强制可以删除

CrashLoopBackOff状态

将pod删除重启 ,如果未启动查看日志
kubectl delete pods xxxx -n xxx
kubectl describe pods -n xxx

Pending状态

pending状态肯定是条件不满足调度,通过查看详细日志来定位
kubectl describe pod xxx -n xxx

2、Container States

kubernetes 会追踪pod 内的container状态

kubectl get pods -n xxxx | grep xxxx

waitting

,pulling the container image from a container image registry, or applying ​Secret​ data

running

container entered the running state

terminated

A container in the ​Terminated​ state began execution and then either ran to completion or failed for some reason

3、pod conditions

pod 有很多的状态,kubelet来控制这些 pod conditions

PodScheduled

the Pod has been scheduled to a node //已被调度到某个node节点

podhashnetwork

the Pod sandbox has been successfully created and networking configured //网络OK

containersReady

all containers in the Pod are ready  //pod 中的containers ready状态

Initialized

all ​init containers​ have completed successfully. // init containers  初始化已完成

ready

the Pod is able to serve requests and should be added to the load balancing pools of all matching Services   //ready for requests