Mastering Memory QoS in Kubernetes v1.36: Tiered Memory Protection Explained
Memory QoS exists to address the challenges of memory management in Kubernetes. As applications scale, ensuring that critical workloads have guaranteed memory while allowing for flexibility in less critical ones becomes essential. Memory QoS achieves this by using the cgroup v2 memory controller, allowing you to specify hard and soft memory protections for your pods.
At its core, Memory QoS utilizes four key interfaces: memory.max for hard limits, memory.min for guaranteed protection (only for Guaranteed Pods), memory.low for soft protection (for Burstable Pods), and memory.high for throttling. The kubelet plays a crucial role by maintaining memory.min across the kubepods root cgroup and memory.low for Burstable QoS cgroups. You can configure Memory QoS through the kubelet configuration, enabling it with featureGates.MemoryQoS and specifying the memoryReservationPolicy to control how memory is reserved.
In production, understanding how to set these parameters effectively is key. Ensure your Kubernetes version is v1.36 or later, and ideally, use a kernel version of 5.9 or higher to avoid known issues like the kernel livelock. The Memory QoS feature is still in alpha, so be prepared for potential changes and ensure thorough testing before rolling it out to critical environments.
Key takeaways
- →Enable Memory QoS by setting featureGates.MemoryQoS to true in your kubelet configuration.
- →Use memory.min for Guaranteed Pods to ensure hard memory protection.
- →Implement memory.low for Burstable Pods to provide soft memory protection.
- →Monitor memory metrics using the command: curl -sk https://localhost:10250/metrics | grep memory_qos.
- →Be aware of kernel compatibility; use kernel 5.9 or higher to avoid livelock issues.
Why it matters
In production, Memory QoS can significantly improve resource allocation, ensuring critical applications remain responsive while optimizing overall cluster performance. This leads to better resource utilization and cost efficiency.
Code examples
1apiVersion: kubelet.config.k8s.io/v1beta1
2kind: KubeletConfiguration
3featureGates:
4 MemoryQoS: true
5memoryReservationPolicy: TieredReservation # Options: None (default), TieredReservation
6memoryThrottlingFactor: 0.9 # Optional: default is 0.91apiVersion: kubelet.config.k8s.io/v1beta1
2kind: KubeletConfiguration
3featureGates:
4 MemoryQoS: true
5memoryReservationPolicy: None
6# This is the default$ curl -sk https://localhost:10250/metrics | grep memory_qosWhen NOT to use this
The official docs don't call out specific anti-patterns here. Use your judgment based on your scale and requirements.
Want the complete reference?
Read official docsUnified observability — logs, uptime monitoring, and on-call in one place. Used by 50,000+ engineering teams to ship faster and sleep better.
Try Better Stack free →Securing GitHub Actions: Best Practices for Dependency Management
In a world where CI/CD pipelines are critical, securing your GitHub Actions dependencies is non-negotiable. Pinning versions and enforcing strict permissions can prevent vulnerabilities from third-party actions. Let's dive into how to implement these strategies effectively.
Unlocking Performance with Kubernetes Pod-Level Resource Managers
Kubernetes v1.36 introduces Pod-Level Resource Managers, a game changer for performance-sensitive workloads. This feature allows for hybrid resource allocation models, enhancing efficiency without compromising NUMA alignment.
Streamline Your Hybrid Kubernetes Networking with EKS Hybrid Nodes Gateway
Hybrid cloud environments are complex, but the Amazon EKS Hybrid Nodes gateway simplifies networking between on-premises and cloud resources. By leveraging Cilium's VXLAN Tunnel Endpoint feature, it creates seamless connections that keep your applications running smoothly.
Get the daily digest
One email. 5 articles. Every morning.
No spam. Unsubscribe anytime.