How do you list all the PODs and containers in your Kubernetes cluster

To list all pods and containers use the below command

kubectl get pods -o=custom-columns=POD:.metadata.name,CONTAINERS:.spec.containers[*].name

To list all pods and containers in a given namespace use the below command

kubectl get pods -o=custom-columns=POD:.metadata.name,CONTAINERS:.spec.containers[*].name -n <<namespace>>

Output of the above command will show PODs and the containers against it in a tabular format.

Details on what are pods and containers in kubernetes are available in this blog : https://belowthemalt.com/2022/05/05/pods-containers-in-kubernetes/

Thanks !!

Leave a Reply