Kubernetes 1.29 Swap Not Utilized on AL2023 (cgroupv2) with Default Kubelet Config

Cluster Info

Kubernetes Version: 1.29
Host OS: Amazon Linux 2023
Cloud: EKS
Comparison Host OS: Amazon Linux 2

Problem

We have observed a behavioral difference in swap memory usage between Kubernetes nodes running on AL2 and AL2023. On AL2 nodes, which use cgroupv1, swap memory is utilized by pods in case of high memory load. Whereas on AL2023 nodes, which use cgroupv2, swap memory appears to be completely unused by default. The swap only becomes active in AL2023 only when the kubelet is explicitly configured as follows.

featureGates:
  NodeSwap: true
memorySwap:
  swapBehavior: UnlimitedSwap

The core question is: Why does the default Kubernetes configuration prevent swap usage on AL2023 (cgroupv2) but not on AL2 (cgroupv1)?