You can give a running pod more CPU without restarting it. In-place pod resize has been stable since Kubernetes v1.35, yet most teams still delete pods just to change a number.

This post is a practical guide: what the feature does, the exact commands, how to read the status, and the limits that will catch you out. Every field and command here comes from the official Kubernetes task page, Resize CPU and Memory Resources assigned to Containers.

The analogy: adjusting the seat while driving

Old Kubernetes made you pull over, get out, and get into a different car whenever you wanted the seat moved. That is a pod delete and recreate: new pod, new IP, cold caches, dropped connections.

In-place resize lets you move the seat while the car is moving. For some adjustments (CPU) that is easy. For others (memory, for many runtimes) the car really does need to stop for a moment, and Kubernetes lets you say which is which.

A short history

The InPlacePodVerticalScaling feature gate went through these stages, per the feature gate definition:

Stage Versions Default
Alpha 1.27 to 1.32 off
Beta 1.33 to 1.34 on
Stable 1.35 onward on, locked

Locked means you cannot turn it off on 1.35 and later. If you run 1.35 or newer, it is already available on your cluster.

The mental model: desired vs actual

Three fields matter:

  • spec.containers[*].resources is the desired state. CPU and memory are now mutable here.
  • status.containerStatuses[*].resources is the actual state: what is configured on the running container right now.
  • status.containerStatuses[*].allocatedResources is what the kubelet has confirmed. The docs call this advanced and say to focus on status.containerStatuses[*].resources for monitoring.

When desired and allocated differ, the kubelet tries to resize. One subtle detail: while a resize is pending or incomplete, the scheduler uses the maximum of desired, allocated and actual requests for that container. So a pending resize already reserves room on the node from the scheduler's point of view.

Choose what restarts: resizePolicy

Each container can say, per resource, whether a change needs a restart. This is the official example pod:

apiVersion: v1 kind: Pod metadata: name: resize-demo namespace: qos-example spec: containers: - name: pause image: registry.k8s.io/pause:3.8 resizePolicy: - resourceName: cpu restartPolicy: NotRequired # Default, but explicit here  - resourceName: memory restartPolicy: RestartContainer resources: limits: memory: "200Mi" cpu: "700m" requests: memory: "200Mi" cpu: "700m" 
  • NotRequired (the default) applies the change to the running container.
  • RestartContainer restarts the container to apply it. The docs note this is often needed for memory, because many apps and runtimes cannot adjust their memory allocation on the fly. Think of a JVM with a fixed max heap.

If you change CPU and memory in the same request, the container restarts, because the memory policy wins. And if the pod's own restartPolicy is Never, every resize policy must be NotRequired.

Do it: the resize subresource

Create the namespace and the pod:

kubectl create namespace qos-example kubectl create -f pod-resize.yaml -n qos-example 

Resize CPU from 700m to 800m. Note --subresource resize; you are not editing the pod spec directly:

kubectl patch pod resize-demo -n qos-example --subresource resize --patch \ '{"spec":{"containers":[{"name":"pause", "resources":{"requests":{"cpu":"800m"}, "limits":{"cpu":"800m"}}}]}}' 

You need kubectl v1.32.0 or later for that flag. Older clients report an invalid subresource error. The docs also list kubectl edit ... --subresource resize and kubectl apply -f <manifest> --subresource resize --server-side as alternatives.

Check it:

kubectl get pod resize-demo -n qos-example -o yaml 

You should see cpu: 800m in both spec and status.containerStatuses[0].resources, with restartCount still 0.

Now resize memory to 300Mi:

kubectl patch pod resize-demo -n qos-example --subresource resize --patch \ '{"spec":{"containers":[{"name":"pause", "resources":{"requests":{"memory":"300Mi"}, "limits":{"memory":"300Mi"}}}]}}' 

This time restartCount goes up to 1, because memory uses RestartContainer. The pod is not recreated; only the container restarts.

Read the status conditions

The kubelet reports progress through pod conditions:

  • PodResizePending with reason: Infeasible: this can never fit on this node, for example more CPU than the node has.
  • PodResizePending with reason: Deferred: it does not fit right now, but might later, for example after another pod leaves. The kubelet keeps retrying.
  • PodResizeInProgress: accepted and allocated, still being applied. Errors show up in message with reason: Error.

The docs show what happens if you ask for "1000" CPU (1000 cores, not millicores): spec shows the desired value, a PodResizePending/Infeasible condition appears with a message like Node didn't have enough capacity: cpu, requested: 800000, capacity: ..., and status.containerStatuses[0].resources keeps the old values. Nothing breaks; you patch again with a sane value.

If several resizes are deferred, the kubelet retries them by PriorityClass first, then Guaranteed before Burstable, then whoever has waited longest.

Put an alert on PodResizePending conditions. A resize that is silently stuck looks exactly like a resize that never happened.

The limits that will bite

From the official limitations list:

  • Only CPU and memory can be resized.
  • QoS class is fixed at creation. A Guaranteed pod must keep requests equal to limits. A Burstable pod cannot make them equal for both CPU and memory. A BestEffort pod cannot gain requests or limits.
  • Memory decreases are best effort. With NotRequired, if current usage is above the new limit, the resize is skipped and stays "In Progress". There is still a race if usage spikes right after the check.
  • No Windows pods, and no pods under the static CPU or Memory manager policies.
  • Swap: pods using swap cannot resize memory requests unless the memory policy is RestartContainer.
  • You cannot remove requests or limits once set, only change them.
  • Ephemeral containers cannot be resized. Sidecars can.

What's new since GA

Two alpha gates arrived in v1.37, both off by default:

  • InPlacePodVerticalScalingSchedulerPreemption (control plane): kube-scheduler watches for Deferred resizes and can evict lower-priority pods on that node to make room for a higher-priority pod's resize. See the v1.37 announcement.
  • InPlacePodVerticalScalingMemoryBackedVolumes (control plane and nodes, cgroup v2 only): lets the resize subresource change sizeLimit on medium: Memory emptyDir volumes.

Separately, resizing pod-level resources (resources set on the pod rather than each container) graduated to beta in v1.36.

Treat alpha gates as lab-only until they graduate.

One caution about controllers

Resizing a pod does not change the Deployment or StatefulSet that owns it. The next rollout creates pods from the template with the old values. Use in-place resize for live tuning and incident response, then write the new numbers back into the template (or let an autoscaler own them) so Git stays the source of truth.

Takeaways

  • In-place resize is stable and locked on since v1.35; no gate to flip.
  • Always use --subresource resize with kubectl v1.32 or newer.
  • Set resizePolicy per resource: NotRequired for CPU, usually RestartContainer for memory.
  • Watch PodResizePending (Infeasible vs Deferred) and compare spec with status.containerStatuses[*].resources.
  • QoS class never changes, memory shrinks are best effort, and Windows is not supported.
  • Write the new values back to your workload template, or the next rollout undoes them.