Kubernetes v1.36: Pod-Level Resource Managers (Alpha)
Kubernetes v1.36 introduces
Pod-Level Resource Managers
as an alpha feature, bringing a more flexible and powerful resource management
model to performance-sensitive workloads. This enhancement extends the kubelet's
Topology, CPU, and Memory Managers to support pod-level resource specifications
(.spec.resources), evolving them from a strictly per-container allocation
model to a pod-centric one.
Why do we need pod-level resource managers?
When running performance-critical workloads such as machine learning (ML) training, high-frequency trading applications, or low-latency databases, you often need exclusive, NUMA-aligned resources for your primary application containers to ensure predictable performance.
However, modern Kubernetes pods rarely consist of just one container. They frequently include sidecar containers for logging, monitoring, service meshes, or data ingestion.
Before this feature, this created a trade-off, to get NUMA-aligned, exclusive resources for your main application, you had to allocate exclusive, integer-based CPU resources to every container in the pod. This might be wasteful for lightweight sidecars. If you didn't do this, you forfeited the pod's Guaranteed Quality of Service (QoS) class entirely, losing the performance benefits.
Introducing pod-level resource managers
Enabling pod-level resources support for the resource managers (via the
PodLevelResourceManagers and PodLevelResources feature gates) allows the
kubelet to create hybrid resource allocation models. This brings flexibility
and efficiency to high-performance workloads without sacrificing NUMA alignment.
Real-world use cases
Here are a few practical scenarios demonstrating how this feature can be applied, depending on the configured Topology Manager scope:
1. Tightly-coupled database (Topology manager's pod scope)
Consider a latency-sensitive database pod that includes a main database container, a local metrics exporter, and a backup agent sidecar.
When configured with the pod Topology Manager scope, the kubelet performs a
single NUMA alignment based on the entire pod's budget. The database container
gets its exclusive CPU and memory slices from that NUMA node. The remaining
resources from the pod's budget form a new pod shared pool. The metrics
exporter and backup agent run in this pod shared pool. They share resources with
each other, but they are strictly isolated from the database's exclusive slices
and the rest of the node.
This allows you to safely co-locate auxiliary containers on the same NUMA node as your primary workload without wasting dedicated cores on them.
apiVersion: v1
kind: Pod
metadata:
name: tightly-coupled-database
spec:
# Pod-level resources establish the overall budget and NUMA alignment size.
resources:
requests:
cpu: "8"
memory: "16Gi"