Kubernetes v1.37: Memory QoS Graduates to Beta
Kubernetes v1.37 marks a significant milestone with Memory QoS graduating to Beta and being enabled by default. This update introduces enhanced memory management capabilities for Linux nodes using cgroup v2, offering cluster operators greater control over container memory allocation and protection.
Overview of Memory QoS in Kubernetes v1.37
Kubernetes v1.37 introduces a major update to the Memory QoS feature, which has now graduated to Beta and is enabled by default. This change reflects the maturity of the feature and its readiness for broader adoption. Memory QoS leverages the memory controller in cgroup v2 to provide the kernel with more precise guidance on how to manage container memory, ensuring better resource allocation and protection for workloads.
Key Changes in v1.37
The MemoryQoS feature gate is now Beta in v1.37, meaning it is enabled by default on all kubelets without requiring any configuration changes. This default setting is safe because the default kubelet configuration does not activate memory throttling or memory reservation unless explicitly configured. As a result, memory.high, memory.min, and memory.low values are not written to cgroups unless users explicitly set them.
Users can now configure specific behaviors through kubelet configuration fields. For example, setting memoryThrottlingFactor to a value between 0 and 1 enables memory.high throttling on Burstable and BestEffort containers. The default for memoryThrottlingFactor has been changed to null in v1.37, ensuring that upgrading to this version does not inadvertently alter runtime behavior for existing clusters.
Configuration Options in v1.37
Cluster operators have several configuration options to tailor Memory QoS to their needs. They can enable memory throttling by setting memoryThrottlingFactor to a specific value. Additionally, they can enable tiered memory protection by setting memoryReservationPolicy to TieredReservation. This allows for more granular control over memory allocation, ensuring that critical workloads receive the necessary resources while less critical ones remain reclaimable.
For users who wish to disable Memory QoS entirely, they can set the feature gate to false and ensure a compatible kubelet configuration. However, this may require adjusting or removing certain configuration fields to avoid conflicts with the new default settings.
Known Limitations and Considerations
One known limitation of the current implementation is that memory reservation is applied node-wide. This means that the memoryReservationPolicy applies to every pod on the node, and there is no option to selectively apply it to individual pods. This can be a challenge for nodes that host a mix of workloads requiring hard reservation and those that should remain reclaimable.
Additionally, hard reservation covers all memory charged to a container's cgroup, including page cache. This can lead to situations where a pod that reads large files holds onto memory that the kernel would otherwise reclaim for other workloads. Cluster operators should be aware of these limitations and consider them when planning their resource management strategies.
Next Steps and Community Involvement
The next milestone for Memory QoS is its graduation to GA (General Availability). Feedback from Beta users will play a crucial role in shaping any remaining adjustments before this step. If users encounter issues or have suggestions, they can file bugs or provide feedback through the Kubernetes community channels.
For those interested in contributing or learning more about the feature, the SIG Node community is a valuable resource. Users can engage with the community through Slack, mailing lists, or SIG Node meetings to stay informed and participate in the development process.
Source: Kubernetes. Analysis based on publicly available information; no hands-on testing is claimed.