How to Use In-Place Pod-Level Vertical Scaling in Kubernetes v1.36
Introduction
Kubernetes v1.36 brings a powerful new capability: In-Place Pod-Level Vertical Scaling. Now in Beta and enabled by default, this feature lets you adjust the aggregate resource budget for a running Pod without necessarily restarting its containers. This guide walks you through everything you need to know to leverage this feature—from understanding the basics to executing a live resize on your cluster.
What You Need
- A Kubernetes cluster running v1.36 or later (the feature gate
InPlacePodLevelResourcesVerticalScalingis enabled by default). - kubectl configured to communicate with your cluster.
- A Pod (or a test Pod) that uses Pod-level resources (spec.resources at the Pod spec level, not per-container).
- Familiarity with resizePolicy settings on individual containers (optional but recommended).
- Administrative privileges to apply patches to Pods (typically
cluster-adminor RBAC roles withpods/scaleandpods/resizeverbs).
Step-by-Step Guide
Step 1: Understand the Feature
In-Place Pod-Level Vertical Scaling allows you to modify the spec.resources field of a running Pod—the aggregate CPU and memory pool shared by all containers. Previously, you could only change per-container limits (which often required restarts). Now you can boost the overall Pod budget on the fly, and containers that inherit their limits from the Pod level will automatically expand their effective bounds. This is ideal for Pods with sidecars where you want to avoid manual per-container recalculations.
Step 2: Verify Your Cluster Version and Feature Gate
Ensure your cluster runs Kubernetes v1.36 or later. Check with:
kubectl version --short
Confirm the feature gate is enabled:
kubectl get nodes -o yaml | grep InPlacePodLevelResourcesVerticalScaling
If you see true (or the gate isn't listed, which means it's enabled by default), you're good to go.
Step 3: Define a Pod with Pod-Level Resources
Create a Pod that specifies resources at the Pod level, not per container. Below is an example YAML with a shared 2 CPU pool:
apiVersion: v1
kind: Pod
metadata:
name: shared-pool-app
spec:
resources:
limits:
cpu: "2"
memory: "4Gi"
containers:
- name: main-app
image: nginx
# No per-container limits – inherits from Pod level
resizePolicy:
- resourceName: cpu
restartPolicy: NotRequired
- name: sidecar
image: nginx
resizePolicy:
- resourceName: cpu
restartPolicy: NotRequired
Apply it:
kubectl apply -f pod-shared.yaml
Step 4: Understand Resource Inheritance and resizePolicy
When you initiate a Pod-level resize, the Kubelet treats the change as a resize event for every container that inherits its limits from the Pod budget. The resizePolicy at the container level determines whether a restart is needed:
- NotRequired (recommended for non‑disruptive updates): The Kubelet updates cgroup limits dynamically via CRI – no restart.
- RestartContainer: The Kubelet restarts the container to safely apply the new boundaries.
Currently, resizePolicy is not supported at the Pod level; it must be defined on each container. Tip: Use NotRequired for most workloads to avoid disruption.
Step 5: Perform an In-Place Resize
To double the CPU from 2 to 4 for the running Pod, use the resize subresource:
kubectl patch pod shared-pool-app --subresource resize --patch '{"spec":{"resources":{"limits":{"cpu":"4"}}}}'
Note: The resize subresource is separate from the standard Pod update endpoint. It triggers the in-place resizing logic.
Once the patch is applied, the Kubelet checks node feasibility and follows a safety sequence:
- Feasibility check: Ensures the node can accommodate the new total request.
- Container-level evaluation: For each container that inherits the Pod resource, the Kubelet applies the appropriate resize policy.
- Resource update: Cgroups are updated (or container restarted) as needed.
If the node doesn't have enough spare capacity, the resize will fail with an error.
Step 6: Verify the Resize
Check the Pod's updated resource status:
kubectl describe pod shared-pool-app
Look for the Resources section at the Pod level – it should show the new CPU limit. You can also monitor container resource usage with kubectl top pod shared-pool-app (requires metrics server).
If any container had restartPolicy: RestartContainer, you'll see a container restart event in kubectl get events.
Tips for Success
- Start with non‑critical workloads until you're comfortable with the behavior.
- Use
NotRequiredfor all containers to avoid restarts – but test with your applications first (some apps don't handle cgroup changes well). - Monitor Pod metrics after resize to ensure the new budget is being used effectively.
- Beware of oversubscription: Resizing doesn't guarantee your app will use the new resources – it only makes them available.
- Automate resizing with tools like Kubernetes Event‑Driven Autoscaling (KEDA) or custom controllers to react to load changes.
- Check RBAC: If you get a forbidding error, ensure your role includes
pods/resizeverb (in addition topatch).
Related Articles
- Rust 1.94.1 Released: Patch Fixes Regressions and Security Vulnerabilities
- Should You Hold Off on the Latest MacBook Pro? The Future Looks Brighter
- Xteink Blocks Third-Party Firmware on Its Pocket-Sized E-Readers, Users Report
- 10 Key Insights into Perplexity's Mac-First Personal Computer Platform
- From Mormon Culture to McDonald's Menu: The Dirty Soda Phenomenon Explained
- Meta Unleashes Open-Source AI to Crack Domestic Concrete Puzzle, Slash Import Reliance
- Ubuntu 26.04 LTS 'Resolute Raccoon': A Comprehensive Upgrade from 24.04
- How to Migrate to React Native 0.82: Embracing the New Architecture