Kubernetes has historically disabled swap memory usage on nodes due to the unpredictability and performance degradation it can cause. But with increasing real-world needs for more flexible memory allocation, especially on constrained or specialized environments, the Kubernetes community has introduced node swap support as a gated, structured feature, now steadily progressing toward GA in Kubernetes v1.32.
This enhancement, defined in KEP-2400, lays the groundwork for controlled swap usage by Kubernetes workloads, starting with Burstable QoS pods only, using the LimitedSwap mode. This approach limits risks by excluding high-priority workloads and reserving swap access for workloads that can safely tolerate it.
Edge deployments and low-memory nodes where provisioning large amounts of RAM isn't feasible
Local development clusters with NVMe or SSD-backed swap for quick disk I/O
Memory-flexible applications (like Java/Node.js) that benefit from swapping infrequently used memory
Virtualized clusters using KubeVirt or similar stacks where memory overcommitment is common
These benefits, however, must be balanced with swap's inherent risks—reduced performance, complexity in eviction behavior, and potential exposure of sensitive data if swap isn't encrypted.
Kubernetes' controlled embrace of swap is a deliberate, conservative step to increase flexibility for real-world workloads while protecting critical system processes. Through precise defaults, targeted QoS class support, and robust observability, node swap support paves the way for advanced memory management scenarios while retaining Kubernetes' core tenets of stability and predictability.
Admins can now provision swap on worker nodes and allow Burstable pods to benefit, without compromising cluster reliability.
FAQs
What is the current status of swap support in Kubernetes?
Swap support is now available in LimitedSwap mode for Burstable QoS pods on cgroups v2 systems. It is controlled via the NodeSwap feature gate and is progressing toward GA in Kubernetes v1.32. By default, swap remains disabled (NoSwap) until explicitly configured.
How do you enable swap support on a Kubernetes node?
To enable swap:
Set the kubelet flag: --fail-swap-on=false
Enable the feature gate: --feature-gates=NodeSwap=true
In the kubelet config, set: MemorySwap.SwapBehavior=LimitedSwap Note: This only works on Linux systems using cgroups v2.
Which pods are eligible to use swap under this configuration?
Only Burstable QoS pods can use swap.
Guaranteed pods are excluded from swap usage.
BestEffort pods are not allocated swap either.
What are the use cases for enabling swap in Kubernetes?
Swap is beneficial for:
Edge or low-memory nodes where physical RAM is limited
Local development clusters using fast swap-backed storage
Memory-flexible apps like Java or Node.js
Virtualized workloads that require memory overcommit (e.g., via KubeVirt)
What should cluster operators consider before enabling swap?