I'm looking for an easy way to find what version of my images I have deployed in my kubernetes environment.
The closest thing I can find to what I want is helm get values <namespace> -a
(but this gets values and dumps all (computed) values)
Is there an easier/clean way to get a list of images and versions deployed??
Thanks in advance
You can use kubectl
to get all images form all pods running in the namespace/cluster. See List All Container Images Running in a Cluster.
For one namespace:
kubectl get pods -n <namespace> -o jsonpath="{..image}" | tr -s '[[:space:]]' '\n' | sort | uniq -c
For the whole cluster:
kubectl get pods --all-namespaces -o jsonpath="{..image}" | tr -s '[[:space:]]' '\n' | sort | uniq -c
I use something like this:
kubectl get po --all-namespaces -o yaml | grep image: | cut -d ":" -f2,3 | sort | uniq
this command shows all images used in your cluster and removes the duplicates.