How to Monitor Kubernetes CPU Limits, Memory Limits and Replicas in Grafana

By now, you've already given your developers access to CPU and memory usage dashboards.

The next thing they would come waving their arms is to know what kind of limits the current app is given and how many instances of the app is running.  To keep them in their seats glued to the screen instead of coming at you, you can add the following tables to your Grafana dashboard and let them find the answers themselves.

View Deployment Memory Limits

Add a table item in the dashboard and configure it as follows:

This query displays the memory limits configured for containers running in the selected namespace and lists them in the table.

kube_pod_container_resource_limits{resource="memory", namespace=~"^$namespace$", container=~".*"}


View Deployment CPU Limits

This query displays the CPU limits configured for containers in the selected namespace.

kube_pod_container_resource_limits{resource="cpu", namespace=~"^$namespace$", container=~".*"} * 1000


View Deployment Replica Count

This table shows the desired replica count for each deployment in the selected namespace. 

kube_deployment_spec_replicas{namespace=~"^$namespace$", pod=~".*"}



Adding these tables gives developers the complete picture and reduces the number of "Can you quickly check something for me?" messages landing in your Teams DM.

#grafana #prometheus

0 Comments