Interview Prep/Monitoring & Observability/Kubernetes Monitoring, Scale & Cloud

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.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Kubernetes Monitoring, Scale & Cloud