How to Get Images of all PODs and Deployments

Let's say you have two similar namespaces in your Kuberentes cluster and you want to compare the images of pods running on both these name spaces.

Or Simply want to know what images are being used across the pods (or) deployments in your namespace

Of course we are going to use kubectl with little jsonpath annonations.


Get Images of All Pods in a NameSpace


You can use the following command to get the list of pods and their images in a nice tabbed format

kubectl get pods -n <your namespace> -o jsonpath='{range .items[*]}{}{" "}{@.spec.containers[*].image}{"\n"}{end}'| column -t

When you have more replicas you might see duplicate pods with the same image name.

In such cases, If you want to see the unique Images used on your namespace use the following command

which sorts and apply unique filter on the column two which contains our image names.

kubectl get pods -n <your namespace> -o jsonpath='{range .items[*]}{}{" "}{@.spec.containers[*].image}{"\n"}{end}'|sort -u -k2|column -t

Now you can take the same outputs for the other namespace by just changing the -n value on the kubectl command if you would like to compare with other namespace.


Get Images of All Deployments in a NameSpace

Now if you want to get all images of All the deployments in your namespace. You need to tweak our previous kubectl command a little like the following

kubectl get deployments -n <your namespace> -o jsonpath='{range .items[*]}{}{" "}{@.spec.template.spec.containers[*].image}{"\n"}{end}'|column -t

Thats all. Now you would be presented with a tabbed columns deployment name followed by the image name/url

something like shown below.

Kubectl list all images of all pods


Hope this helps.


Sarav AK

Follow me on Linkedin My Profile
Follow DevopsJunction onFacebook orTwitter
For more practical videos and tutorials. Subscribe to our channel

Buy Me a Coffee at

Signup for Exclusive "Subscriber-only" Content