How can I have the Container Name for Deployments/Stateful/Jobs/DaemonSet with a command

Cluster information:

Kubernetes version:
All of them?

Hey All, A general help Trying to access more quickly the Containers for the Deployments/Stateful/Jobs/DaemonSet. I’m working on extracting the CPU/MEM and Req/Lim For those Guys Separately. With Pods I can use the kubectl get pods -o=jsonpath={} and play with the format
But I haven’t had any luck with the neither of them → (Deployments/Stateful/Jobs/DaemonSet)
Any commands useful or any suggestions??

Below example for deployment and can modify it to list the container name for DaemonSet/Jobs/StatefulSets :

kubectl get deploy -ojsonpath='{.items[*].spec.template.spec.containers[*].name}{"\n"}'


1 Like

This works perfect!!
Thanks :smiley: