Kubernetes pods OOM-killed despite plentiful node memory due to cgroup v2 memory.high vs kubelet eviction mismatch
Environment
On-prem K8s 1.24 cluster running kubelet with cgroup v2 enabled on Ubuntu 22.04 nodes. Pods scheduled with resource requests/limits (memory limits present). Node has 128 GB RAM; during batch jobs pods are OOM-killed even though node allocatable memory shows plenty free. Kubelet version 1.24.3, container runtime containerd 1.6.
Symptoms
Multiple pods receive SIGKILL and kubectl describe pod shows 'OOMKilled'. Node-level free memory high (top, free -h), but dmesg shows kernel memory cgroup pressure and OOM events tied to the pod's cgroup. kubelet logs show eviction decisions triggered despite no global node eviction threshold reached.
Observations
cgroup v2 is active (mountpoint /sys/fs/cgroup). cat /sys/fs/cgroup/memory.current shows pods' cgroup usage exceeds memory.high. kubelet is configured with eviction thresholds based on nodefs and memory.available. The per-cgroup memory.high enforcement is causing kernel to throttle/kill processes before kubelet evictions. Pod memory limits close to real usage; some pods spawn many worker threads increasing RSS beyond expected peak.
Already attempted
Increased pod memory limits, restarted kubelet (no immediate effect), disabled memory swap with swapoff (system already had swap disabled). Tried raising kubelet eviction threshold (e.g., --eviction-hard), but pods still killed before kubelet action.
Question
How do we align cgroup v2 memory.high enforcement with Kubernetes kubelet eviction behavior so pods aren't killed unexpectedly when node has free memory? What safe kernel or kubelet changes reduce premature per-cgroup OOMs?
Verified community troubleshooting
Start by increasing the container memory limit for one affected pod to provide headroom and rerun the job — if OOMs stop, limits are the issue. While testing, inspect /sys/fs/cgroup/.../memory.current and memory.high for the pod to confirm kernel enforcement. If kernel kills still occur before kubelet evicts, raise kubelet memory eviction thresholds slightly earlier so kubelet can act first. Do the change on a single node, validate no node-wide instability, then roll out. If unsure, collect cgroup and kubelet logs and escalate to platform team rather than disabling kernel cgroup controls.
Incident analysis
Most likely causes
Summary
Suggested Fixes
Continue troubleshooting
Related troubles
Matched from the title, description and tags
- Cloud Computing49% match
Kubernetes pods OOMKilled while node shows 80GB free memory on Ubuntu 20.04 (kubelet+Docker cgroup mismatch suspected)
Open0 answers - Cloud Computing43% match
Kubernetes pods repeatedly OOM-killed even though node has ample free memory — cgroup vs kubelet limit mismatch
Open0 answers - Cloud Computing33% match
Kubernetes pods CrashLoopBackOff only on upgraded nodes with hugepages enabled — short lived OOM at container startup
Open0 answers - Cloud Computing29% match
Kubernetes StatefulSet pods fail to mount Ceph PVCs on nodes upgraded to newer kubelet: 'failed to find device' in kubelet logs
Open0 answers - Cloud Computing25% match
Kubernetes nodes fail to pull container images after containerd overlay storage filled on GKE-like cluster
Open0 answers