Ranking your container registries
Today I learned how to rank container registries used in a Kubernetes cluster using Prometheus. Using the query below, Prometheus can provide you with a list of all container registries your Kubernetes cluster currently depends on, based on all existing containers running on your cluster. This can help to assess how reliant your cluster is on third-parties and which third-parties these are. By extending the
by (image, namespace), you can even check which namespaces depend on what external registries.
count(label_replace(kube_pod_container_info, "image", "$1", "image", "([^/]+)/.*")) by (image)
I came across this at work, when we were discussing whether we are hitting rate-limits of an external registry and how to handle this. In order to back up the thesis that the will hit these soon, we decided to check how popular this registry was in the clusters.