Skip to content

Instantly share code, notes, and snippets.

@jstrachan
Last active March 2, 2018 06:58
Show Gist options
  • Save jstrachan/16e22b1d4d584e3be2acf0cabb20c327 to your computer and use it in GitHub Desktop.
Save jstrachan/16e22b1d4d584e3be2acf0cabb20c327 to your computer and use it in GitHub Desktop.

The status of a pod depends on a few things

Phase

A pod has a phase...

Pending

Pending means the pod has been accepted by the system, but one or more of the containers has not been started. This includes time before being bound to a node, as well as time spent pulling images onto the host.

Running

Running means the pod has been bound to a node and all of the containers have been started. At least one container is still running or is in the process of being restarted.

Succeeded

Succeeded means that all containers in the pod have voluntarily terminated with a container exit code of 0, and the system is not going to restart any of these containers.

Failed

Failed means that all containers in the pod have terminated, and at least one container has terminated in a failure (exited with a non-zero exit code or was stopped by the system).

Unknown

Unknown means that 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.

Container statuses

A pod has N containers where N >= 1. Each container has a status

Events

Various events can happen during the lifetime of a pod. e.g.

  • downloading the docker image
  • mounting volumes for the pod
  • running init containers

Conditions

A pod has N conditions which are boolean flags. Mostly they indiciate lifecycle things. e.g.

  • Scheduled
  • Initialized
  • Ready

Summary

So the list of statuses, trying to combine those together is

The natural order of statuses things go through:

  • Pending
  • Scheduled
  • Initialized
  • Running
  • Ready

Then if the pod finishes

  • Terminating
  • Succeeded
  • Failed
  • Unknown

When watching a well behaved Pod for a very long time it will cycle through these until its removed...

  • Pending
  • Scheduled
  • Initialized
  • Running
  • Ready
  • Terminating

After Terminating its gone, so has no state.

From a UI I'm not sure there's huge value in differentiating Pending from Scheduled - it generally means 'its gonna show up somewhere soon'.

Also Succeeded and Failed means the pod was running once and now is not any more.

The biggie is Ready which means the process is running and k8s has deemed it ready according to liveness / readiness checks. Otherwise Running is the next best thing; its almost ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment