参考官网文档:http://kubernetes.io/docs/user-guide/pod-states/
介绍pod生命周期的blog :http://blog.youkuaiyun.com/horsefoot/article/details/52324830(比较详细 )
一下图片摘自以上blog:
Pod的状态
- Pending: The pod has been accepted by the system, but one or more of the container images has not been created. This includes time before being scheduled as well as time spent downloading images over the network, which could take a while.
- Running: The pod has been bound to a node, and all of the containers have been created. At least one container is still running, or is in the process of starting or restarting.
- Succeeded: All containers in the pod have terminated in success, and will not be restarted.
- Failed: All containers in the pod have terminated, at least one container has terminated in failure (exited with non-zero exit status or was terminated by the system).
- Unknown: For some reason the state of the pod could not be obtained, typically due to an error in communicating with the host of the pod
Pod LifeTime
pod的状态不完全取决于容器的状态,还与RestartPolicy 重启策略有关 。
Termination of Pods
Because pods represent running processes on nodes in the cluster,
it is important to allow those processes to gracefully terminate
when they are no longer needed (vs being violently killed with a
KILL signal and having no chance to clean up). Users should be
able to request deletion and know when processes terminate,
but also be able to ensure that deletes eventually complete.
When a user requests deletion of a pod the system records the intended grace period
before the pod is allowed to be forcefully killed,
and a TERM signal is sent to the main process in each container.
Once the grace period has expired the KILL signal is sent to those processes
and the pod is then deleted from the API server. If the Kubelet or the container manager
is restarted while waiting for processes to terminate, the termination will be retried
with the full grace period.
Pod中的容器状态:
Waiting
Running
Terminated