What are the kubernetes pod phases equivalence to pod status?

12/16/2019

I need to know what are the all possible STATUS a kubernetes pod can have.

My Problem: - I found these status by using kubectl get pods command

  • Running
  • Pending
  • ImagePullBackOff
  • CrashLoopBackOff
  • Completed

But when I open the yaml file for a pod which it says Completed in its STATUS, yaml definition is Succeeded. This is its phase

So that means, it in yaml there is another value and when I use kubectl get pods it gives another value.

These are the pod phases in yaml definitions:

  • Pending
  • Running
  • Succeeded
  • Failed
  • Unknown

I want to know what would I get as the equivalence to these above commands when I execute kubectl get pods (eg: I get Completed for Succeeded) ?

-- To Rrent
kubernetes

1 Answer

12/16/2019

Kubernetes is setting a Status to the pod (so status is Primary), status itself can have Phase. So for example Status Completed can be assigned to Phase Succeeded and Phase Failed, While Status Running can't be assigned to this phases.

But in general, its almost same Running is Running, Pending is Pending. Phases Unknown as far as i remamber means node is unreachable, and can't report pod status.

As official documentation states:

A Pod’s status field is a PodStatus object, which has a phase field.

The phase of a Pod is a simple, high-level summary of where the Pod is in its lifecycle. The phase is not intended to be a comprehensive rollup of observations of Container or Pod state, nor is it intended to be a comprehensive state machine.

The number and meanings of Pod phase values are tightly guarded. Other than what is documented here, nothing should be assumed about Pods that have a given phase value.

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

-- Oleg Butuzov
Source: StackOverflow