How to get list of terminated and running pods list using Kubectl command

4/20/2019

I want to see the list of terminated and running pods details in Kubernetes.

Below command only shows the running pods, somehow I want to see the history of all pods so far terminated.

$ ./kubectl get pods -o wide
NAME     READY     STATUS    RESTARTS   AGE       IP              NODE
POD1     1/1       Running   0          3d        10.333.33.333   node123
POD2     1/1       Running   0          4d        10.333.33.333   node121
POD3     1/1       Running   0          1m        10.333.33.333   node124

I expect the terminated pods list using kubectl command

-- Uday Kiran
kubectl
kubernetes

1 Answer

4/21/2019

Since v1.10 kubectl prints terminated pods by default:

--show-all (which only affected pods and only for human readable/non-API printers) is now defaulted to true and deprecated. The flag determines whether pods in a terminal state are displayed. It will be inert in 1.11 and removed in a future release.

If running older versions than v1.10, you still need to use the --show-all flag.

-- Eduardo Baitello
Source: StackOverflow