Kubernetes Rightsizing: Setting Requests with VPA and In-Place Pod Resize
Your node bill follows the requests you declare, not the CPU and memory pods actually use. Here is a workflow to close that gap: measure, get recommendations from the Vertical Pod Autoscaler, and apply them without restarting pods.
Published December 3, 2026 · HostingX Solutions LLC
Short answer
Requests decide cost. The scheduler places pods by their requests, and cluster autoscalers add nodes for pods that don't fit, so inflated requests turn into idle nodes you pay for.
Measure first: compare a week or more of real CPU and memory usage with requests, then run the Vertical Pod Autoscaler (VPA) in
Offmode to get recommendations without changing anything.In-place pod resize is stable since Kubernetes 1.35. CPU and memory requests and limits can change on a running pod through the
resizesubresource; whether the container restarts is set per resource withresizePolicy.VPA's InPlaceOrRecreate mode is GA in VPA 1.6.0: it resizes in place when it can and evicts only when it must. The old
Automode is deprecated.Don't run VPA and HPA on the same metric. Use VPA for memory and HPA for CPU, or HPA on custom metrics.
Why Requests Drive the Bill
Kubernetes uses a container's requests to decide where it can run, and the kubelet reserves at least the requested amount for it. Usage below the request is capacity that nobody else can be scheduled into. Because cluster autoscalers such as Karpenter and Cluster Autoscaler add nodes when pods can't be scheduled, requests set much higher than usage translate directly into more nodes. Rightsizing means bringing requests close to what workloads really use, with headroom, so the same nodes hold more pods.
| Setting | What Kubernetes does with it | What goes wrong when it’s wrong |
|---|---|---|
| CPU request | The scheduler uses it to pick a node, and the kubelet reserves at least that much for the container | Too high: you pay for nodes that sit idle. Too low: pods land on busy nodes and compete for CPU. |
| CPU limit | Enforced by throttling: the kernel stops the container using more CPU than the limit | Too low: latency spikes from throttling even when the node has spare CPU. |
| Memory request | Used for scheduling; a container may use more if the node has it free | Too low: nodes get overcommitted and pods are evicted or killed under memory pressure. |
| Memory limit | Enforced reactively with OOM kills when the kernel detects memory pressure | Too low: OOMKilled restarts. Too high: no protection for neighbors. |
The quality of service (QoS) class also follows from these settings: Guaranteed when every container's requests equal its limits for both CPU and memory, BestEffort when no requests or limits are set, and Burstable for everything in between. It matters later because an in-place resize can't change a pod's QoS class.
Step 1: Measure Usage Against Requests
Use at least a week of data so weekly patterns and batch jobs show up. With Prometheus scraping cAdvisor and kube-state-metrics (the standard kube-prometheus-stack setup), these queries give a high percentile of CPU, peak memory and current requests per container:
PromQL: p95 CPU cores used per container over 7 days
quantile_over_time(0.95,
rate(container_cpu_usage_seconds_total{container!="", namespace="checkout"}[5m])[7d:5m]
)PromQL: peak memory working set per container over 7 days
max_over_time(container_memory_working_set_bytes{container!="", namespace="checkout"}[7d])PromQL: current CPU requests per container
kube_pod_container_resource_requests{resource="cpu", namespace="checkout"}A reasonable starting point is CPU requests near the p90 to p95 of usage and memory requests near the observed peak plus a safety margin, then adjust per service. Memory deserves the bigger margin, because running out of CPU slows a container down while running out of memory gets it killed.
Step 2: Get Recommendations from VPA
VPA is an add-on, not part of core Kubernetes. It has three parts: the recommender, which analyzes usage; the updater, which applies changes by evicting pods or resizing them in place; and an admission webhook that sets requests on new pods. Run it in Off mode first, and bound its recommendations with minAllowed and maxAllowed:
vpa-checkout.yaml (recommendations only)
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
name: checkout
namespace: checkout
spec:
targetRef:
apiVersion: apps/v1
kind: Deployment
name: checkout
updatePolicy:
updateMode: "Off"
resourcePolicy:
containerPolicies:
- containerName: "app"
minAllowed:
cpu: 100m
memory: 128Mi
maxAllowed:
cpu: "2"
memory: 2Gi
controlledResources: ["cpu", "memory"]
controlledValues: RequestsOnlyRead the result with kubectl describe vpa checkout -n checkout. RequestsOnly tells VPA to change requests and leave limits alone; the default, RequestsAndLimits, scales limits in proportion to requests. To see recommendations for a whole namespace at once, Fairwinds' open source Goldilocks creates a VPA in recommendation mode for each workload and shows the results in a dashboard.
Step 3: Apply the New Requests
The safest path for most teams is to treat recommendations as input and commit new requests to Git, so they go through review and your normal GitOps rollout. Once you trust the numbers, let VPA apply them. These are the update modes:
| VPA update mode | Behavior | Good fit |
|---|---|---|
| Off | Calculates recommendations; changes nothing | Start here on every workload |
| Initial | Sets requests only when pods are created; never touches running pods | Workloads that restart often anyway, such as frequent deploys |
| Recreate | Evicts pods whose requests differ significantly from the recommendation | Stateless services with enough replicas and a PodDisruptionBudget |
| InPlaceOrRecreate | Resizes running pods in place when it can, falls back to eviction when it can’t. GA in VPA 1.6.0 | Most workloads once recommendations look right; AKS recommends it over Recreate |
| InPlace | Resizes in place only and never evicts; defers and retries instead. Alpha in VPA 1.7.0 | Pods that must not be evicted; test before production |
| Auto | Deprecated since VPA 1.4.0; an alias for Recreate | Replace with Recreate or InPlaceOrRecreate |
In-place pod resize
In-place resize first appeared in Kubernetes 1.27 and has been stable since 1.35; the feature gate is now locked on. It needs a 1.33 or newer control plane, and the --subresource resize flag needs kubectl 1.32 or newer. Each container can say whether a change needs a restart:
Container resizePolicy
resizePolicy: - resourceName: cpu restartPolicy: NotRequired - resourceName: memory restartPolicy: RestartContainer
NotRequired is the default. With the policy above, a CPU-only change applies to the running container, and any change that includes memory restarts the container, which suits runtimes that can't release or grow memory on the fly. To resize manually:
Resize CPU on a running pod
kubectl patch pod checkout-7d9f -n checkout --subresource resize --patch \
'{"spec":{"containers":[{"name":"app","resources":{"requests":{"cpu":"800m"},"limits":{"cpu":"800m"}}}]}}'If the node can't fit the new size, the pod gets a PodResizePending condition with reason Infeasible (impossible on this node) or Deferred (retried later), and keeps its old resources. Limits to know about:
Only CPU and memory can be resized, and the QoS class can't change.
Windows pods don't support in-place resize, and pods under static CPU or Memory manager policies can't be resized in place.
Lowering a memory limit without a restart is best effort: if usage is above the new limit, the resize stays in progress.
Requests and limits can't be removed once set, and ephemeral containers can't be resized. Sidecar containers can.
VPA and HPA Together
The VPA project says it shouldn't be used with the Horizontal Pod Autoscaler on the same resource metric. If both react to CPU, VPA raises requests while HPA computes utilization against those requests, and the two fight. The supported combinations are VPA on memory with HPA on CPU, or HPA on custom and external metrics such as queue depth or requests per second. On GKE, Google points to multidimensional Pod autoscaling for this case.
GKE, AKS and Other Clusters
| Platform | How VPA is provided | Notes |
|---|---|---|
| GKE | Enabled by default in Autopilot clusters; configure it on Standard clusters | InPlaceOrRecreate is in Preview and needs 1.34.0-gke.2201000 or later. Don’t combine with HPA on CPU; Google offers multidimensional Pod autoscaling instead. Keep fewer than 1,000 VPA objects per cluster. |
| AKS | Preconfigured in AKS Automatic; optional and configured explicitly in AKS Standard | InPlaceOrRecreate on AKS 1.34+. Optimal support up to 1,000 pods with VPA objects; recommender keeps up to eight days of history; no Windows containers; JVM workloads not supported. |
| Other clusters (including self-managed) | Install the open source VPA from kubernetes/autoscaler, plus Metrics Server if the cluster doesn’t have it | VPA reads usage from the metrics.k8s.io API, which Metrics Server provides. |
After Pods, Rightsize Nodes
Smaller requests only save money when nodes are removed. Make sure your node autoscaler consolidates underused nodes, and check instance types against the new pod shapes. Our guides to Kubernetes cost optimization on EKS, GKE and AKS and Kubernetes unit economics cover the next steps, and Kubecost alternatives compares tools that report request-versus-usage waste by team. Disclosure: GetFinOps, our own product, finds waste and runs approved savings actions on AWS and Google Cloud.
Frequently Asked Questions
What is Kubernetes rightsizing?
Setting each container's CPU and memory requests (and limits) to match what it actually uses, with headroom. Because the scheduler and node autoscalers work from requests, rightsizing lets the same workloads run on fewer or smaller nodes.
Does in-place pod resize restart the container?
Not by default. resizePolicy defaults to NotRequired, so the change is applied to the running container. Set RestartContainer for memory if your runtime can't adjust its memory use without a restart.
Should I use VPA in automatic mode in production?
Start with Off, review the recommendations, then move workloads that tolerate it to InPlaceOrRecreate, with minAllowed and maxAllowed bounds and a PodDisruptionBudget for the eviction fallback.
Why do my pods get throttled when the node has spare CPU?
A CPU limit is a hard limit enforced by the kernel. When a container reaches it, it's throttled whether or not the node is busy. Check throttling metrics before lowering limits, and consider whether latency-sensitive services need a CPU limit at all.
Can VPA rightsize JVM applications?
Be careful. The AKS docs say VPA doesn't support JVM-based workloads because of limited visibility into their actual memory use, and the GKE docs say it isn't ready for them. Size the heap explicitly and set memory requests from it.
Paying for nodes your pods don't use?
We help US businesses rightsize Kubernetes on EKS, GKE and AKS: usage baselines, VPA rollout with safe bounds, HPA design and node consolidation, with every change reviewed in Git. The first 30-minute consultation is free.
Related Articles
Kubernetes Cost Optimization on EKS, GKE and AKS
Provider-specific levers beyond pod requests.
Karpenter vs Cluster Autoscaler
Turning smaller requests into fewer nodes.
Kubernetes Cost Management Tools
Tools that show request-versus-usage waste.
Kubernetes FinOps Unit Economics
Cost per request, tenant or team.
See also: FinOps services · Cloud waste elimination · Service mesh comparison
Services
Subscribe to our newsletter
Get monthly email updates about improvements.
© 2026 HostingX Solutions LLC. All Rights Reserved.
LLC No. 0008072296 | Est. 2026 | New Mexico, USA
Terms of Service
Privacy Policy
Acceptable Use Policy