Vertical scaling and in-place resize
Changing how much CPU and memory a Pod gets: in-place resize through the resize subresource, its rules, and the Vertical Pod Autoscaler that picks the numbers.
Requests, limits and QoS classesThe Horizontal Pod Autoscaler
Vertical scaling and in-place resize
The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.
Not started
What you'll learn
- Vertical scaling changes a Pod's requests and limits instead of its replica count. It suits workloads that can't spread out, and right-sizing everything else.
- In-place resize (GA in 1.35) changes CPU and memory of a running Pod through the resize subresource. A normal update to spec.containers[*].resources is still rejected.
- A resize can't remove requests or limits, change the QoS class, or touch anything but CPU and memory. resizePolicy decides per resource whether the container restarts.
- spec holds the desired resources and status.containerStatuses[*].resources the applied ones. The kubelet reports PodResizePending (Deferred or Infeasible) or PodResizeInProgress while they differ.
- The Vertical Pod Autoscaler recommends requests from usage history (90th percentile plus a 15% margin by default) and applies them in Off, Initial, Recreate or InPlaceOrRecreate mode.
- Don't let VPA and HPA both act on CPU or memory for the same workload. Each changes the other's input, and they fight.
Some workloads can’t just add replicas
The HPA handles load by adding Pods. That only helps when work spreads across them. A single-primary database, a cache whose working set grew, a batch job that needs more memory, or a JVM that needs more CPU for a minute at startup: none of these get better with a second copy.
There is also the quieter problem. Most requests are guesses made on the day a service shipped. Set too high, they waste nodes, because the scheduler reserves capacity nobody uses. Set too low, the app is throttled or OOM-killed. Vertical scaling is about getting the size of each Pod right, and changing it when the right size changes.
For most of Kubernetes’ history, a Pod’s resources were fixed for its lifetime. Changing them meant deleting and recreating the Pod: a restart, lost in-memory state, a cold cache. In-place resize removes that restriction. It went GA in Kubernetes 1.35.
Resources are immutable, except through resize
A normal update still can’t touch resources. Patching a running Pod’s CPU request on a lab API server got the familiar rejection:
The Pod "cache" is invalid:
* spec: Forbidden: pod updates may not change fields other than `spec.containers[*].image`, ...
The change has to go through the Pod’s resize subresource, a separate endpoint with its own validation and its own RBAC permission (pods/resize):
apiVersion: v1
kind: Pod
metadata:
name: cache
spec:
containers:
- name: cache
image: redis:8
resources:
requests: {cpu: 500m, memory: 256Mi}
limits: {cpu: "1", memory: 512Mi}
resizePolicy:
- resourceName: cpu
restartPolicy: NotRequired
- resourceName: memory
restartPolicy: RestartContainer
$ kubectl patch pod cache --subresource=resize \
-p '{"spec":{"containers":[{"name":"cache","resources":{"requests":{"cpu":"800m"},"limits":{"cpu":"1500m"}}}]}}'
pod/cache patched
resizePolicy says, per resource, whether the kubelet can apply a change to a running container (NotRequired, the default) or must restart it (RestartContainer). CPU almost always resizes live: it is a cgroup quota the kernel enforces from the next scheduling period. Memory is trickier. Raising a limit is easy, but an app that sized its heap at startup won’t use the extra until it restarts, which is why this example restarts on memory changes.
The rules a resize must follow
The same API server rejected each of these:
Pod QOS Class may not change as a result of resizing
spec.containers[0].resources.limits: Forbidden: resource limits cannot be removed
spec: Forbidden: only cpu and memory resources are mutable
- QoS class is fixed. Making requests equal limits would turn this Burstable Pod Guaranteed. The kubelet places Pods in cgroup trees by QoS class and can’t move a running one.
- Requests and limits can change but not appear or disappear.
- Only CPU and memory. Ephemeral storage, GPUs and extended resources are out.
Lowering the memory limit, from 512Mi to 384Mi, was accepted. Early versions forbade it. Now the kubelet applies it on a best-effort basis, refusing if current usage is above the new limit.
Desired versus actual
After the CPU resize, the Pod held two different answers:
spec: {"limits":{"cpu":"1500m","memory":"512Mi"},"requests":{"cpu":"800m","memory":"256Mi"}}
status: {"limits":{"cpu":"1","memory":"512Mi"},"requests":{"cpu":"500m","memory":"256Mi"}}
spec is what you asked for. status.containerStatuses[*].resources is what the kubelet has applied. They differ here because the lab has no kubelet. On a real node, the kubelet checks whether the node has room, updates the cgroups through the container runtime, and reports progress in Pod conditions:
PodResizePendingwith reasonDeferred: feasible, but the node is too full right now. The kubelet retries as other Pods leave.PodResizePendingwith reasonInfeasible: the node could never fit it, for example asking for more CPU than the node has.PodResizeInProgress: accepted and being applied.
The scheduler accounts for the larger of desired and applied, so a Pod being resized can’t be overcommitted by new arrivals. Pod-level resources (spec.resources for the whole Pod) can be resized too, behind a beta gate that is on by default in 1.37.
The Vertical Pod Autoscaler picks the numbers
In-place resize is the mechanism. Choosing the values is the job of the Vertical Pod Autoscaler, an add-on from the kubernetes/autoscaler project (v1.8.1 when checked) with three parts: a recommender, an updater and an admission webhook.
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
name: cache
spec:
targetRef:
apiVersion: apps/v1
kind: StatefulSet
name: cache
updatePolicy:
updateMode: InPlaceOrRecreate
resourcePolicy:
containerPolicies:
- containerName: cache
minAllowed: {cpu: 250m, memory: 256Mi}
maxAllowed: {cpu: "2", memory: 2Gi}
The recommender keeps decaying histograms of each container’s usage. Its defaults, from its config source: target CPU is the 90th percentile of usage, memory the 90th percentile of daily peaks, each plus a 15% safety margin, with lower and upper bounds at the 50th and 95th percentiles. Memory uses peaks because it can’t be throttled. Running short means an OOM kill.
updateMode decides what happens with the recommendation:
Off: write it to the VPA’s status and change nothing. A safe way to start.Initial: apply it only when Pods are created.Recreate: evict Pods whose requests are far off, so they come back with new values.Autois a deprecated alias for this.InPlaceOrRecreate: resize in place, falling back to eviction if the resize is infeasible or stuck. On by default since VPA 1.5.
VPA and HPA on the same metric fight
If the HPA scales on CPU utilization and the VPA raises CPU requests, utilization (usage divided by requests) drops, so the HPA removes Pods, so usage per Pod rises, so the VPA raises requests again. Use one per resource. A common split is HPA on a request-rate metric and VPA on CPU and memory, or VPA in Off mode purely for sizing advice.
About the video
The embed is Tim Allclair and Mofi Rahman’s KubeCon talk “In-Place Pod Resize in Kubernetes: Dynamic Resource Management Without Restarts”, published November 2025, 30 minutes. Allclair, from SIG Node, is one of the feature’s owners. Going by its chapters, it covers a live resize, the resource lifecycle, resize states and errors, limitations, VPA integration, language runtime considerations (heap sizing at startup), the roadmap and an advanced demo. I judged it from chapters and description only, since transcripts couldn’t be fetched. It was recorded before 1.35’s GA and later changes, so check details against the current docs. English was judged from the title, speakers and English caption track. The page shows no audio-language flag. Carlos Santana’s 2026 talk in deeper is a gentler introduction.
What was run: the immutable-resources rejection, the accepted CPU and memory resizes, the three rule violations and the spec/status difference are real output from a local Kubernetes v1.37.3 API server whose nodes run no containers. I patched the Pod’s status by hand to report applied resources, as a resize-capable kubelet would. Without that the API server refuses with “Pod running on node without support for resize”, a version-skew guard in validation.go. Condition names are from core/v1/types.go. VPA modes and recommender defaults are from the kubernetes/autoscaler repository’s docs and source, checked 2026-11-28.
Where this fits
CPU and memory are poor signals for queue workers. Next: event-driven autoscaling with KEDA.
Check yourself
You run kubectl edit on a running Pod to raise its CPU request and get 'pod updates may not change fields other than...'. How do you resize it?
Send the change to the resize subresource, for example kubectl patch pod NAME --subresource=resize -p '{...}'. Resources are mutable only through that subresource, which applies the resize-specific validation.
A Burstable Pod has requests 500m/256Mi and limits 1/512Mi. Why is a resize that sets requests equal to limits rejected?
It would make the Pod Guaranteed. In-place resize may not change the QoS class, because the kubelet places Pods in cgroup hierarchies by QoS and can't move a running Pod between them.
After a resize, kubectl shows the new values in spec, but the app still sees the old CPU limit. Where do you look?
At status.containerStatuses[*].resources, which is what the kubelet actually applied, and at the PodResizePending or PodResizeInProgress conditions. Deferred means the node lacks room now, Infeasible means it never will.
Why does the VPA recommend memory from peaks rather than averages?
Memory can't be throttled. Running out means an OOM kill, so the recommender takes the peak per interval (24 hours by default), a high percentile of those peaks, and adds a safety margin.
Go deeper
Notes
Notes are saved to your account.
Everything else on this page works without one — progress and bookmarks keep themselves in this browser and come with you when you sign in. Notes are the one thing worth not trusting to a browser you might clear.
Your notes could not be loaded.