Three ways to identify which images are running in a Kubernetes cluster

Three ways to identify which images are running in a Kubernetes cluster

2 min read

There are three ways to get information about the images running in Kubernetes.

Using Kubectl

The easiest way to find out which image is running is to parse the Kubernetes json api. This command will show you every image running in a cluster. To narrow it down to a namespace just change –all-namespaces  to –namespace=mynamespace

Here’s the command

kubectl get pods --all-namespaces -o jsonpath="{..image}" |
tr -s '[[:space:]]' 'n' |
sort |
uniq -c

This will parse the json using some regex. It’s not particularly useful, especially if you have lots of images!

Using the Kubernetes UI

Fire up kubectl proxy and look under workloads. You’ll see something like this:

One of the limitations here is that if the image name is really long (like if you’re using a private registry url) it will be truncated so you may not actually be able to see the image.

Which is why I recommend using Codefresh.

Using Codefresh (Bonus info)

Once you’ve connected your cluster to Codefresh, just navigate to the Kubernetes -> Services page.

You can filter out multiple clusters, namespaces etc to get a view like this.

Here you can see in this namespace I have two images deployed. One is mongo:latest and the other is a private image I built and deployed. The bonus here is that you can click on that image to get a full report about it.

Here I get way more information about the image including testing data and the commit id. One more click and I can even see the diff of what changes went into an image.

Conclusion

So there you have it! The first two methods have a lot of limitations. Using Codefresh ultimately gives you a lot more information. Go ahead and signup, it’s free!

Bonus Video

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Build your GitOps skills and credibility today with a GitOps Certification.

Get GitOps Certified

Ready to Get Started?
  • safer deployments
  • More frequent deployments
  • resilient deployments