How to Implement Tiered Memory Protection with Memory QoS in Kubernetes v1.36

By

Introduction

Kubernetes v1.36 introduces significant updates to the Memory QoS feature, first introduced in v1.22 and refined in v1.27. This guide walks you through setting up and leveraging the new tiered memory protection mechanism, which uses the cgroup v2 memory controller to give the kernel better guidance on how to treat container memory. By the end, you'll know how to enable the feature, configure memory reservation policies, and monitor memory protection across Pod QoS classes.

How to Implement Tiered Memory Protection with Memory QoS in Kubernetes v1.36

What You Need

Step-by-Step Guide

Step 1: Enable the MemoryQoS Feature Gate

The MemoryQoS feature is alpha in v1.36, so you must explicitly enable it. Edit the kubelet configuration (usually found at /var/lib/kubelet/config.yaml or passed via command line) to add MemoryQoS: true under featureGates. Then restart the kubelet process.

# Example kubelet config snippet
featureGates:
  MemoryQoS: true

After restart, verify that the feature is active by checking the kubelet logs or the /metrics endpoint (see Step 5).

Step 2: Configure the memoryReservationPolicy

By default, enabling MemoryQoS only activates throttling via memory.high (based on memoryThrottlingFactor, default 0.9). To enable tiered memory reservation, you need to set memoryReservationPolicy in the kubelet configuration. Two options exist:

To use tiered protection, add memoryReservationPolicy: TieredReservation to the kubelet configuration:

memoryReservationPolicy: TieredReservation

Restart the kubelet after making this change.

Step 3: Understand Tiered Protection Behavior

Once TieredReservation is enabled, the kubelet automatically applies memory protection based on the Pod's QoS class:

Step 4: Verify the Cgroup Values

After deploying a Pod, you can verify the protection settings directly on a node. SSH into a node and navigate to the Pod's cgroup directory under /sys/fs/cgroup/kubepods.slice/. For example:

# Check memory.min for a Guaranteed Pod
$ cat /sys/fs/cgroup/kubepods.slice/kubepods-pod6a4f2e3b_1c9d_4a5e_8f7b_2d3e4f5a6b7c.slice/memory.min
536870912

# Check memory.low for a Burstable Pod
$ cat /sys/fs/cgroup/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod8b3c7d2e_4f5a_6b7c_9d1e_3f4a5b6c7d8e.slice/memory.low
536870912

Ensure the values match the Pod's memory request.

Step 5: Monitor Memory QoS Metrics

Kubernetes v1.36 exposes two alpha observability metrics on the kubelet /metrics endpoint:

Metric Description
kubelet_memory_qos_node_memory_min_bytes Total memory reserved via memory.min on the node (from Guaranteed Pods).
kubelet_memory_qos_node_memory_low_bytes Total memory reserved via memory.low on the node (from Burstable Pods).

These metrics help you understand how much memory is protected and make informed decisions about headroom. You can scrape them with Prometheus or any Prometheus-compatible monitoring tool.

Step 6: Compare with Previous Behavior

In earlier versions (v1.22–v1.27), enabling MemoryQoS set memory.min for every container with a memory request, regardless of QoS class. This could lock up a large portion of memory, leaving little for system daemons or BestEffort workloads. For instance, on an 8 GiB node with Burstable Pods requesting 7 GiB total, all 7 GiB would be hard-reserved, increasing OOM risk.

With TieredReservation in v1.36, Burstable pods use memory.low instead, allowing the kernel to reclaim that memory under extreme pressure. Only Guaranteed pods use memory.min, keeping hard reservation lower and providing more headroom for the node.

Tips and Best Practices

Related Articles

Recommended

Discover More

10 Fascinating Facts About the Ucayali River as Seen from Space8 Things You Need to Know About Cloudflare Handing the Keys to AI Agents7 Critical Updates on Climate, Food, and Energy: Strait of Hormuz, BECCS, and Fertilizer CrisisTesla Semi in Action: MDB Transportation's Port Pilot ProgramStep-by-Step: Updating Your Linux Apps with April 2026’s Best Releases