Using Kube-state-metrics in prometheus to get the total number of containers running on a node

3/17/2020

kube-state-metrics allows me to find the number of pods running on each node by running

sum by (node) (kube_pod_info)

I can get the number of containers in every pod by running

sum by (pod) (kube_pod_container_info)

However, the kube_pod_container_info doesn't tell me the node the containers are running on.

However, I can't find a way to get the total number of containers on each node by chaining these two queries together. Is there an existing query that already does this for me?

-- Jatinshravan
kube-state-metrics
kubernetes
prometheus
promql

0 Answers