In-Place Pod Resize in Kubernetes: Resize CPU and Memory Without Recreating Pods
In-place pod resize lets you change a running container's CPU and memory requests and limits without recreating the pod, using the resize subresource and per-resource resizePolicy controls. This guide covers the desired-versus-actual resource model, PodResizePending and PodResizeInProgress status, QoS limits, memory-decrease headroom rules, VPA InPlaceOrRecreate automation, and the failure modes that still force a restart or a recreate in production clusters.
1. What in-place pod resize changes for running workloads
In-place pod resize changes a running container's CPU and memory requests and limits without deleting or recreating the pod. You patch desired resources through the resize subresource, the kubelet rewrites the container's cgroup allocation, and the pod keeps its identity, IP address, node placement, and volumes throughout the change.
Illustrative composite: a payments platform runs a stateful API tier whose pods hold warm connection pools and in-memory caches. During a traffic peak the on-call engineer sees CPU saturation and rising tail latency. The old fix, editing the Deployment template, would roll every pod, drop warm caches, and add a second latency spike on top of the first. With in-place pod resize the engineer raises CPU requests and limits on the running pods instead. The kubelet updates cgroup quotas, latency recovers, and no pod restarts. That contrast, fixing saturation without paying a rollout, is the operational reason this feature matters.
Before this feature, container resources in a running pod were effectively immutable. Any change to requests or limits required the workload controller to create replacement pods and terminate the old ones. That model is safe and simple, but it couples every sizing correction to a rollout. For stateless tiers with fast starts the cost is small. For databases, queue workers with long drain times, JVM services with slow warm-up, and single-replica stateful pods, the rollout cost dominates the fix. Teams responded by over-provisioning requests to avoid frequent resizes, which wasted node capacity and distorted scheduling.
In-place pod resize breaks that coupling for CPU and memory at the container level. Sizing becomes an adjustable runtime property rather than a template-only decision. The change sounds small, but it reshapes three workflows: incident response gains a non-disruptive lever, vertical autoscaling stops requiring eviction for many adjustments, and rightsizing experiments can run against live pods instead of staging replicas. The rest of this guide treats the feature as production machinery, including the cases where a restart or a recreate is still the honest answer. For the autoscaling context around it, see HPA vs VPA in Kubernetes.
2. How in-place pod resize works: desired, allocated, and actual resources
In-place pod resize works through three resource views: desired resources in the pod spec, allocated resources confirmed by the kubelet, and actual resources reported in container status. A resize completes only when actual resources match desired resources, so status, not the spec, proves the change landed.
The mental model has three fields and confusing them causes most false conclusions. Desired resources live in spec.containers[].resources. They are what you asked for, and CPU and memory there are now mutable through the resize subresource. Actual resources live in status.containerStatuses[].resources and describe what is configured on the running container right now. Allocated resources in status.containerStatuses[*].allocatedResources record what the kubelet has accepted and confirmed, which scheduling logic uses internally. When you patch a pod, the spec updates immediately. The container keeps running on its old allocation until the kubelet acts.
The kubelet watches for a gap between desired and allocated resources. When it finds one, it checks whether the node can satisfy the new requests, whether container restart policies allow an in-place change, and whether memory can move in the requested direction. If the checks pass, it rewrites cgroup settings for the container: CPU weight and quota for CPU changes, memory limits for memory changes. It then updates allocated and actual resources in status. If the checks fail, the resize stays pending and status conditions explain why, which section 6 covers in detail.
Scheduling accounting during a pending resize is deliberately conservative. While a resize is incomplete, the scheduler counts the maximum of desired, allocated, and actual requests for that container on the node. An upsize that has not landed yet already reserves room, so the scheduler will not pack another pod into capacity the resize is about to claim. A downsize, conversely, does not free schedulable room until the kubelet confirms it. Operators who watch only node allocatable totals miss this nuance and misread why a node looks fuller than expected during a resize campaign.
One boundary belongs in the model from the start. In-place pod resize applies to container-level CPU and memory. Pod-level aggregate resources, extended resources such as GPUs, and most other pod spec fields still require recreation. Treat the feature as a vertical adjustment for the two classic compressible and incompressible resources, not as general pod mutability. The Kubernetes QoS and eviction guide explains why the QoS consequences of those two resources differ so sharply.
3. In-place pod resize maturity: versions, gates, and honest caveats
In-place pod resize is stable since Kubernetes v1.35 after alpha in v1.27 and beta enabled by default in v1.33. The InPlacePodVerticalScaling gate is locked on in stable releases, kubectl v1.32 or newer is required for the resize subresource, and pod-level resize remains a separate track.
Version history matters because mixed clusters behave differently at each stage. The feature appeared as alpha in Kubernetes v1.27 behind the InPlacePodVerticalScaling feature gate, disabled by default. It graduated to beta in v1.33, enabled by default on control plane and nodes. It reached stable in v1.35, where the gate is locked on: setting it explicitly has no effect, and the behavior cannot be disabled. The official task guide targets server version v1.33 or later, and the kubectl client must be v1.32 or newer to use --subresource resize. Verify both sides before debugging anything else, because an old client against a new cluster fails in ways that look like permission errors.
Managed Kubernetes adds rollout lag to that picture. A provider may offer v1.35 control planes while node pools still run older kubelets, and the kubelet is the component that applies resizes. Check node versions, not only the API server version, when a resize stalls. Admission and policy tooling also lag: Pod Security Standards do not block resizes, but custom admission webhooks and GitOps reconcilers can revert spec changes made outside Git. A resize applied with kubectl against a GitOps-managed pod will be reverted at the next reconciliation unless the desired resources also change in the source manifests or the controller owns the resize.
Three related capabilities are often confused with the stable feature and should not be promised as part of it. Pod-level resource resize, changing aggregate spec.resources, follows its own graduation track. Scheduler preemption for deferred resizes, where the scheduler evicts lower-priority pods to make room, arrived later as an alpha gate. Memory-backed emptyDir volume resizing is likewise separate. An honest production plan enables container-level CPU and memory resize on v1.35 or newer clusters, treats v1.33 and v1.34 as usable beta ground with extra testing, and keeps recreation as the fallback for everything outside that envelope.
4. resizePolicy in in-place pod resize: NotRequired vs RestartContainer
In-place pod resize uses resizePolicy to decide, per resource, whether a change needs a container restart. NotRequired applies the new cgroup values to the running process, while RestartContainer restarts the container so runtimes that size memory at startup pick up the new allocation cleanly.
Each container declares resize behavior per resource. NotRequired is the default: the kubelet updates cgroup values and the process keeps running. RestartContainer tells the kubelet to restart the container when that resource changes, inside the same pod, so the pod identity, IP, and volumes survive while the process restarts. If a single resize changes both CPU and memory and either policy says RestartContainer, the container restarts. If the pod's own restartPolicy is Never, every resize policy must be NotRequired, because a restart is not available.
CPU almost always belongs on NotRequired. CPU quota and weight changes take effect on the running process with no cooperation from the application, and the change is reversible in seconds. Memory is the judgment call. Runtimes that read cgroup limits dynamically, including Go programs using GOMEMLIMIT derived from the cgroup and many native services, handle live memory changes well. Runtimes that fix heap size at startup, notably JVMs with explicit -Xmx and Node.js with --max-old-space-size, ignore a live memory increase until restart and can die on a live decrease they never see coming. For those workloads RestartContainer on memory is the correct, honest setting.
| Policy | CPU resize | Memory resize | Container restart | Best fit |
|---|---|---|---|---|
| NotRequired | Applies live | Applies live if headroom allows | No | CPU everywhere; memory for cgroup-aware runtimes |
| RestartContainer | Restarts to apply | Restarts to apply | Yes, same pod | JVM, Node.js, and fixed-heap memory changes |
| Mixed (CPU NotRequired, memory RestartContainer) | Live for CPU-only changes | Restarts when memory changes | Only on memory changes | Most production services |
Declare the policy in the workload template so every new pod carries it, rather than patching pods one at a time. A resize policy added after an incident helps the next incident only if the template change rolls out before it.
5. Step by step: in-place pod resize with the resize subresource
In-place pod resize runs through the pod resize subresource: patch desired CPU or memory with kubectl patch --subresource resize, then verify status.containerStatuses resources match the request. Always confirm actual resources and restart counts afterward, because an accepted patch does not guarantee an applied resize.
Work in a scratch namespace first. The example pod requests and limits CPU and memory equally, which places it in the Guaranteed QoS class, and sets CPU to resize live while memory restarts the container:
Create the namespace and pod, then raise CPU from 500m to 750m. Because the pod is Guaranteed, request and limit move together; section 7 explains why that pairing is mandatory:
The status resources should show 750m and the restart count should stay at zero. Now raise memory and watch the container restart inside the same pod, because the memory policy requires it:
Two operational habits separate a clean resize from a confusing one. First, patch only the containers and resources you mean to change; the resize subresource rejects unrelated spec edits. Second, verify with status after every patch. A successful API response means the desired state was recorded. Only status.containerStatuses[*].resources proves the kubelet applied it. Teams that skip verification discover failed resizes during the next incident, when the headroom they counted on does not exist.
6. Reading in-place pod resize status: PodResizePending and PodResizeInProgress
In-place pod resize status surfaces through PodResizePending and PodResizeInProgress conditions. Deferred means the kubelet will retry when node capacity frees up, Infeasible means the request can never fit on that node, and InProgress means the kubelet is actively applying the new allocation.
When desired and actual resources diverge, the kubelet reports why through pod conditions. PodResizePending with reason Deferred means the resize is valid but the node cannot grant it yet, typically because other pods hold the requested capacity. The kubelet retries periodically, and the resize lands when capacity frees or a neighbor shrinks. PodResizePending with reason Infeasible means the request exceeds what the node can ever provide, such as a memory request larger than node allocatable memory. Retrying will never succeed; the pod must move or the request must shrink. PodResizeInProgress means the kubelet is mid-application, for example waiting for a container restart or for memory to drain before a decrease.
Read the conditions directly instead of guessing from events:
The triage order is short. Check the condition reason first. For Deferred, inspect node allocatable capacity and the requests of co-located pods; the fix is capacity, a smaller resize, or patience with a bounded wait. For Infeasible, compare the request against node capacity and against namespace ResourceQuota, because quota rejection at admission looks different from kubelet infeasibility and needs a quota change, not a retry. For a stuck InProgress, check restart counts and container logs, since a crash-looping container can hold a memory resize open indefinitely.
Alerting should treat pending resizes as first-class signals. A resize deferred for minutes during a peak is an incident in progress: the workload asked for headroom and did not get it. Page on PodResizePending older than a few minutes for tier-one workloads, and dashboard the gap between desired and actual resources per namespace. The PromQL alerting guide covers the throttling and memory-pressure alerts that usually fire alongside a stalled resize.
7. In-place pod resize and QoS: the class never changes
In-place pod resize never changes a pod's QoS class. Guaranteed pods must keep requests equal to limits for CPU and memory on every container, Burstable pods must stay Burstable, and any resize that would reclassify the pod is rejected or must move requests and limits together.
QoS class is computed at pod creation from the relationship between requests and limits, and in-place pod resize treats it as immutable. A Guaranteed pod has requests equal to limits for both CPU and memory on every container. Resizing only its CPU request would silently demote it to Burstable, changing its eviction priority and CPU sharing behavior. Kubernetes forbids that drift: for Guaranteed pods, move request and limit together in the same patch, for both resources you touch. A Burstable pod must remain Burstable, so a resize cannot set every request equal to every limit and promote it to Guaranteed. BestEffort pods, with no requests or limits at all, cannot be resized into existence; adding resources to them is not an in-place operation.
This immutability is a feature, not an oversight. Eviction order, CPU weight, and OOM scoring all derive from QoS class and requests. Letting a resize quietly reclassify a pod would change its survival odds under node pressure without any review of that consequence. The constraint forces sizing changes to be explicit about the contract the pod runs under. If a workload genuinely needs a different QoS class, recreate the pod with a corrected template and accept the rollout; that is a scheduling-contract change, not a resize.
Plan resize automation around the constraint. Vertical autoscaling recommendations that propose request changes without matching limit changes will fail or misbehave on Guaranteed pods unless the automation moves both fields. Test resize playbooks against each QoS class in staging, because a playbook tuned on Burstable services breaks on the first Guaranteed database it touches. The QoS classes and eviction order guide gives the full eviction ranking that QoS immutability protects.
8. Memory decreases in in-place pod resize: headroom decides
In-place pod resize handles memory increases cleanly but memory decreases only when the container already uses less than the new limit. Without headroom the kubelet defers the resize or the container risks an OOMKill, so shrink memory slowly and verify working set first.
CPU and memory behave differently under resize because the resources differ physically. CPU is compressible: lowering a CPU limit throttles the process, which slows down but survives. Memory is incompressible: lowering a memory limit below current usage leaves the kernel no graceful path. The cgroup memory controller cannot reclaim pages the process actively holds, so the kernel OOM killer terminates a process in the cgroup. In-place pod resize respects that physics. A memory increase expands the cgroup ceiling and applies immediately. A memory decrease applies only when current usage already fits under the new ceiling; otherwise the kubelet defers and retries, waiting for usage to fall.
The operational rule follows directly. Before shrinking memory, measure the container working set over a representative window, including peaks, page cache behavior, and runtime overhead. Shrink in steps, verifying actual resources and restart counts after each step. For runtimes with fixed heaps, pair the decrease with RestartContainer so the process restarts under the new ceiling and sizes its heap accordingly, accepting a brief restart instead of an unbounded deferral. Never shrink memory on a pod already showing memory pressure events; the resize and the pressure compound each other.
Watch the failure signature while shrinking. A deferred memory decrease shows PodResizePending while usage stays high. An OOMKill during a decrease shows exit code 137 and OOMKilled in the container status, which means the new ceiling landed while usage exceeded it, usually because a restart-based resize applied the limit before the process released memory. The OOMKilled troubleshooting guide separates limit-induced kills from node-pressure kills, and that distinction decides whether to raise the limit back or investigate a leak. Downsizing campaigns that ignore headroom convert a cost exercise into an outage.
9. In-place pod resize with VPA InPlaceOrRecreate automation
In-place pod resize becomes continuous rightsizing when the Vertical Pod Autoscaler runs in InPlaceOrRecreate mode: VPA tries a live resize first and falls back to recreation only when in-place is impossible. Start CPU-only on stateful tiers, bound recommendations, and keep disruption budgets in place.
Manual resizes fix incidents. Automation prevents them. The Vertical Pod Autoscaler recommender analyzes historical usage and proposes requests; the updater applies them. With updateMode: InPlaceOrRecreate, the updater attempts an in-place resize first and evicts for recreation only when the in-place path cannot satisfy the recommendation, for example when the node lacks capacity or the change violates QoS constraints. The pod's resizePolicy still governs restarts: an in-place update with RestartContainer on memory restarts the container without recreating the pod. A stricter InPlace mode exists for teams that would rather skip an update than recreate, at the cost of recommendations that may never land.
Roll out in stages. Run VPA in Off mode first and read recommendations against your own percentile analysis. Then enable InPlaceOrRecreate with controlledResources: [cpu] on stateless tiers, observe resize conditions and latency for a full traffic cycle, and add memory only after the CPU path proves boring. Bound every policy with minAllowed and maxAllowed so a recommender excursion cannot resize a tier into a node it cannot fit. Keep PodDisruptionBudgets in place regardless: the recreate fallback still evicts, and the budget is what keeps that fallback safe. Compare the horizontal alternative in HPA vs VPA before committing a tier to vertical automation, because CPU-bound stateless tiers often scale better horizontally.
10. Limits of in-place pod resize: pods that cannot resize
In-place pod resize cannot resize every pod: Windows pods, pods under the static CPU manager policy with integer CPUs, and pods with non-restartable init containers face hard limits. Extended resources and pod-level aggregates also stay immutable, so recreation remains the fallback for those cases.
Know the exclusions before writing automation that assumes universal coverage. Windows pods do not support in-place resize. Pods running under the static CPU manager policy with integer CPU allocations pin containers to exclusive CPUs, and changing those allocations in place conflicts with the pinning model; a dedicated feature track addresses exclusive CPUs separately. Init containers that cannot restart block resizes that would require their restart, while restartable sidecar containers resize like regular containers. Pods whose containers use extended resources such as GPUs keep those allocations fixed; only CPU and memory move.
Node and runtime constraints add softer limits. A resize that requests more than the node can allocate stays infeasible until the pod moves, and in-place resize never reschedules a pod to a bigger node. Container runtimes older than the kubelet's resize support can fail to apply cgroup changes, which surfaces as a stuck in-progress resize rather than a clean error. Memory decreases against containers with large page cache or memory-mapped files behave worse than heap-only workloads, because reclaimable cache and dirty pages follow different rules than anonymous memory.
The planning consequence is a two-lane sizing strategy. Lane one is in-place pod resize for CPU and memory adjustments on Linux pods with ordinary allocations, which covers most services. Lane two is template change plus controlled rollout for QoS reclassification, GPU changes, Windows workloads, and static-CPU pinning changes. Document which lane each tier uses. Incidents get worse when an engineer discovers mid-incident that the database tier lives in lane two. The ResourceQuota and LimitRange guardrails guide covers the namespace ceilings that bound both lanes.
11. Troubleshooting in-place pod resize failures in production
In-place pod resize troubleshooting starts with pod conditions, then compares desired, allocated, and actual resources, then checks node capacity, quota, and QoS constraints in that order. Most failures are deferred capacity waits, infeasible requests, or QoS violations rather than kubelet defects.
Work the matrix top to bottom. Each row pairs a symptom with the check that confirms it and the fix that resolves it, ordered by how often each cause appears in production.
| Symptom | Likely cause | Confirm with | Fix |
|---|---|---|---|
| Patch accepted, resources unchanged | Resize pending or client too old | Pod conditions; kubectl version | Read condition reason; upgrade kubectl to v1.32+ |
| PodResizePending, Deferred | Node lacks free capacity | Node allocated resources vs allocatable | Shrink co-located pods, add capacity, or wait with a bound |
| PodResizePending, Infeasible | Request exceeds node capacity | Compare request to node allocatable | Reduce request or recreate pod on a larger node |
| Admission rejects the patch | ResourceQuota or LimitRange ceiling | Quota usage in namespace | Raise quota or lower the resize target |
| Guaranteed pod resize rejected | Request moved without matching limit | Pod QoS class and patch body | Move request and limit together |
| Container restarted unexpectedly | Memory policy is RestartContainer | resizePolicy in pod spec | Expected behavior; use NotRequired only for cgroup-aware runtimes |
| Memory decrease never lands | Working set exceeds new limit | Container memory usage vs target | Shrink in steps or restart with the new ceiling |
| Resize reverted minutes later | GitOps reconciler owns the spec | Controller sync status | Change desired resources in Git or let the controller resize |
| OOMKilled during shrink | New ceiling below live usage | Exit code 137, OOM events | Restore prior limit, investigate usage, shrink slower |
Two checks resolve most ambiguous cases. First, diff desired against actual resources: if they match, the resize landed and the problem is elsewhere, usually application behavior under the new allocation. Second, read the condition message verbatim before searching logs; the kubelet states the blocking reason plainly, and engineers lose time when they skip it. If throttling persists after a successful CPU upsize, the bottleneck moved: check whether the limit, not the request, still caps the container, using the CPU throttling guide.
12. Production checklist for in-place pod resize adoption
In-place pod resize is production-ready when clusters run v1.35 or newer, templates declare resizePolicy per resource, automation bounds every change, and alerts watch pending resizes. Adopt CPU-first, verify actual resources after every change, and keep recreation documented as the fallback path.
Adopt in this order and do not skip the verification steps:
- Confirm every node kubelet runs a version with stable in-place pod resize, and standardize kubectl v1.32 or newer in runbooks and CI images.
- Declare
resizePolicyin workload templates:NotRequiredfor CPU, and memory set per runtime, withRestartContainerfor fixed-heap JVM and Node.js services. - Test resizes per QoS class in staging, including Guaranteed request-plus-limit moves and a deliberate infeasible request.
- Route GitOps-managed workloads through Git: resize by changing desired resources in source manifests, or grant the autoscaler explicit ownership.
- Bound VPA with
minAllowed,maxAllowed, and CPU-only control first; keep PodDisruptionBudgets for the recreate fallback. - Alert on
PodResizePendingage and on desired-versus-actual resource gaps; dashboard resize outcomes per namespace. - Shrink memory only with measured working-set headroom, in steps, watching restart counts and OOM events after each step.
- Document the recreation lane for Windows pods, static-CPU workloads, GPU changes, and QoS reclassification.
- Review rightsizing wins monthly against node utilization and cost, using the Kubernetes cost optimization guide to confirm savings are real.
The discipline that makes in-place pod resize safe is verification. Every resize ends with a status read proving actual resources match the request and restart counts match expectations. Teams that build that habit get the full benefit: sizing corrections without rollouts, vertical autoscaling without routine eviction, and incident response with a lever that does not drop warm state. Teams that patch and assume accumulate silent no-ops until an incident exposes them.
Frequently Asked Questions
What is in-place pod resize in Kubernetes?
In-place pod resize changes a running container's CPU and memory requests and limits without recreating the pod. You update desired resources through the resize subresource, the kubelet rewrites cgroup allocations, and status reports the actual resources once applied. The pod keeps its identity, IP, node, and volumes.
Which Kubernetes version supports in-place pod resize?
In-place pod resize is stable since Kubernetes v1.35, after alpha in v1.27 and beta enabled by default in v1.33. Use server v1.33 or newer for the documented task flow, prefer v1.35 for production, and run kubectl v1.32 or newer for the --subresource resize flag.
Does in-place pod resize restart the container?
Only when resizePolicy requires it. CPU with NotRequired applies live with no restart. Memory with RestartContainer restarts the container inside the same pod so fixed-heap runtimes pick up the new ceiling. Changing both resources in one patch restarts when either policy demands a restart.
Why is my in-place pod resize stuck in PodResizePending?
Deferred means the node lacks capacity right now and the kubelet will retry. Infeasible means the request exceeds what the node can ever grant, so reduce the request or recreate the pod elsewhere. Also check ResourceQuota admission limits and QoS rules, which block resizes before the kubelet acts.
Can in-place pod resize change a pod's QoS class?
No. QoS class is fixed at pod creation. Guaranteed pods must move requests and limits together, Burstable pods must stay Burstable, and BestEffort pods cannot gain resources in place. Changing QoS class requires recreating the pod from a corrected template.
How does VPA use in-place pod resize?
With updateMode InPlaceOrRecreate, the Vertical Pod Autoscaler tries an in-place resize first and falls back to eviction and recreation only when in-place cannot satisfy the recommendation. Bound policies with minAllowed and maxAllowed, start with CPU-only control, and keep PodDisruptionBudgets for the fallback path.
When should I recreate instead of using in-place pod resize?
Recreate for QoS reclassification, GPU or extended-resource changes, Windows pods, static CPU manager pinning changes, and requests larger than the current node can grant. In-place pod resize covers container CPU and memory on ordinary Linux pods; everything outside that envelope needs a rollout.
Preparing for Senior Platform & SRE Interviews
Practice real-world cluster triage, RBAC debugging, and pod scheduling scenarios in our Kubernetes scenario interview questions hub.
Explore Interview Scenarios →