Video in progress

In a multi-team Kubernetes cluster, resource utilization is around 25%, but the nodes are "full". How do you analyze it, and what do you do?

This shows that requests were set much higher than actual usage: the scheduler places by requests. You need to bring each service's requests closer to its real p95 usage, use VPA recommendations, namespace quotas, and show teams their cost.

📖 Answer

First I measure: for every namespace and workload, the sum of requests, the actual usage (p50/p95/max), and the gap between them. In Prometheus, kube_pod_container_resource_requests and container_memory_working_set_bytes are enough. The picture you usually find: 20% of services account for 80% of the waste.

The Java-specific cause: teams double the memory "so it doesn't get OOMKilled", and ask for 2 cores of CPU for the JIT peak at startup while using 0.2 in the normal state.

Then what I do:

  1. Right-sizing: I run VPA in recommendation mode and hand the recommendations to teams as PRs. For Java I do not put VPA in automatic mode: when the memory requests change, the heap changes too through MaxRAMPercentage, and that leads to unexpected GC behavior.
  2. No CPU limit, realistic requests: the startup peak is covered by bursting, and requests match the steady state.
  3. Showback: every team gets a monthly "your requests cost $X, you used $Y". This has more effect than technical measures.
  4. ResourceQuota and LimitRange at the namespace level: defaults and an upper bound.
  5. Bin packing: the cluster autoscaler removing empty nodes; matching node types to workloads.

The risk: if you set requests too low, once the nodes are really full, eviction and throttling start, and the platform team gets the blame. So changes are made step by step, with each service's SLO being watched.

The goal is not 80%. Utilization around 50-60% is often a good balance with a safe reserve.