"kubectl get pods" - Getting pod status with/without custom-columns option

Cluster information:

Kubernetes version: 1.22.3
Cloud being used: bare-metal
Installation method:
Host OS: Ubunto 20.04
CNI and version:
CRI and version:

The pods status I get when running “kubectl get pods” is different than the pods status I get when running “kubectl get pods -o=custom-columns=NAME:.metadata.name,STATUS:.status.phase”.
Specifically I see that when the pod status is “Terminated” when running the first command, it is “Running” when running the latter.
Here is a screenshot that shows this scenario.

Obviously the status.phase is not the same status as the one provided by “kubectl get pods”, but I haven’t found any way to get this status when using the custom-columns option.
Is there anyway to do it?


Kubectl get pod <podname>  -o yaml

In the status section (towards the end of the output) you should get the detailed and most current info about the pod.

Hope that helps.

Thank you @Theog75 for your reply.
I am aware of the “-o yaml” option you’ve suggested, but it’s not exactly what I am looking for because it doesn’t directly give the status provided by “kubectl get pods”.
Currently I solved the problem by doing a kind of “hack” described here: How to Determine the Pod Terminating status using REST API · Issue #22839 · kubernetes/kubernetes · GitHub
However, I think it would be helpful if the status provided by “kubectl get pods” can also be retrieved with the custom-columns option.

1 Like