Which cAdvisor container memory metric should you watch, and why?
IntermediateConceptKubernetes Monitoring, Scale & Cloud
Answer
| Metric | Meaning |
|---|---|
container_memory_usage_bytes |
Total usage including all page cache; overstates real pressure |
container_memory_working_set_bytes |
Usage minus inactive file cache; what the kubelet uses for eviction and what kubectl top shows |
container_memory_rss |
Anonymous memory (heap, stacks); cannot be reclaimed |
container_memory_cache |
Page cache, mostly reclaimable |
We alert on working set against the limit:
sum by (namespace, pod, container) (container_memory_working_set_bytes{container!=""})
/
sum by (namespace, pod, container) (kube_pod_container_resource_limits{resource="memory"}) > 0.9
Filter container!="" and container!="POD" to avoid double counting the pod-level cgroup and the pause container.
More on Kubernetes Monitoring, Scale & Cloud
What is kube-prometheus-stack and what does it install?BeginnerWhat CRDs does the Prometheus Operator provide?IntermediateHow does the Prometheus Operator decide which ServiceMonitors to load?IntermediateHow do metrics-server and the custom/external metrics APIs relate to HPA?IntermediateWhich kube-state-metrics metrics do you use most?BeginnerWhat endpoints does the kubelet expose for Prometheus?Advanced