This article explains how to improve Kubernetes node density for memory-intensive, bursty workloads by leveraging the General Availability of swap support in Kubernetes v1.34. By using cgroup v2 for independent memory and swap accounting alongside high-speed NVMe local SSDs, clusters can offload dormant application memory to disk, effectively overcoming RAM exhaustion limits.
Key points
Kubernetes v1.34+ allows node swap via cgroup v2, which enables independent accounting of physical RAM and disk-based swap.
Using local NVMe SSDs for swap significantly mitigates the traditional latency penalties associated with paging memory to disk.
Setting containers to 'Burstable' QoS allows the kubelet to offload idle memory to swap, enabling higher pod density on existing hardware.
The 'LimitedSwap' configuration prevents performance degradation by ensuring that only idle, anonymous memory is paged out.