HPA vs VPA in Kubernetes

The HPA changes how many pods run. The VPA changes how much CPU and memory each pod requests.

Published 22 October 2026 · Updated 3 November 2026 · By Sonia (opens in a new tab), Developer relations, Zoorik

VPA vs HPA: the VPA sets pod size, the HPA sets pod count

Short answer. Use the Horizontal Pod Autoscaler (HPA) when load rises and falls and more pods help. Use the Vertical Pod Autoscaler (VPA) when each pod’s requests sit far from its real use. You can run both, but not on the same CPU or memory metric: the HPA reads load against the request the VPA keeps changing.

When to use each

Take two Deployments. In the first, each pod uses 200m of the 500m of CPU it requests, all day. More pods would each reserve another 500m. This is the VPA’s job: it sets the request near real use, such as 250m.

In the second, traffic pushes 4 pods to 140% of their CPU request against a 70% target. The requests are fine, but 4 pods are too few. This is the HPA’s job: it scales to 8.

The VPA changes how big each pod is, the HPA how many run Two panels side by side. Left panel, VPA changes pod size, on one CPU scale from 0 to 500m with ticks at 0, 250m and 500m. Before: an outline bar for a request of 500m. After: a teal bar for a request of 250m. In both rows a violet bar inside the request reaches 200m, marked uses 200m. Between the rows, a highlighted arrow reads VPA sets the request near use. Right panel, HPA changes pod count. Before: 4 pod boxes, at 140% of their request. After: 8 pod boxes of the same size. Between the rows, a highlighted arrow reads HPA scales out against a 70% target. Illustration. The VPA changes how big each pod is, the HPA how many run VPA changes pod sizeHPA changes pod countBEFORErequest 500mVPA sets the request near useAFTERrequest 250muses 200m0250m500mBEFORE4 pods at 140% of their requestHPA scales out against a 70% targetAFTER8 pods
Illustration: the two Deployments from the text, one needing a smaller request and one needing more pods.
  • Use the HPA when load rises and falls. The workload must be able to add replicas. For a CPU or memory utilization target, every container needs a request for that resource, or the HPA takes no action on that metric.
  • Use the VPA when requests sit far from real use. It suits a steady service that more pods wouldn’t help.
  • Use both on different signals. For example, a CPU-based HPA with a memory-only VPA.
  • Keep the VPA off DaemonSet pods where a node autoscaler runs. Kubernetes warns it can make the autoscaler’s capacity predictions unreliable.

Key differences

QuestionVPAHPA
What it changes
Each container’s CPU and memory requests, and by default its limits in the same ratio
The number of replicas
Part of Kubernetes
No. An add-on with its own custom resource, autoscaling.k8s.io/v1
Yes. Built into the core API, autoscaling/v2
On AKS and EKS
Preconfigured in AKS Automatic. In AKS Standard you set it up yourself. On EKS, install Metrics Server, then run the autoscaler project’s vpa-up.sh script
Built in
What it reads
Current and past CPU and memory use, and out-of-memory events
Usage as a share of the request, every 15 seconds, or custom and external metrics
How a change lands
Evicts and recreates pods, or resizes them in place on Kubernetes 1.33 or later
Adds or removes pods. Scale-down waits 300 seconds by default
What it needs
A metrics source such as Metrics Server
A metrics source, and a request on every container for a utilization target
What it can’t do
Add pods, or remove nodes
Resize a pod, or scale a DaemonSet
Fits best
Requests far from real use
Load that rises and falls

How they work

The VPA

The VPA is an add-on from the Kubernetes autoscaler project, not part of the core API. You point its VerticalPodAutoscaler custom resource at a workload, such as a Deployment. It then sets that workload’s CPU and memory requests from measured use. By default it scales limits too, keeping the pod spec’s ratio of limit to request.

Three components do the work:

  • Recommender. It reads current and past use, including out-of-memory (OOM) events, and stores a target request in the VPA’s status.
  • Updater. It evicts or resizes running pods whose requests are far from that target, within their PodDisruptionBudgets.
  • Admission controller. This mutating webhook writes the target into new pods.

Microsoft’s AKS documentation adds two limits. The recommender keeps at most 8 days of history. JVM-based workloads aren’t supported, because the VPA has limited visibility into their real memory use.

The VPA update modes, set in the updateMode field, decide what happens to running pods:

  • Off only recommends: you read the target with kubectl describe vpa/<name> and apply it yourself.
  • Initial sets requests only when a pod is created.
  • Recreate evicts running pods whose requests differ significantly from the target, so they come back at the new size.
  • Auto is deprecated, and for now behaves exactly like Recreate.
  • InPlaceOrRecreate applies an in-place pod resize to running pods, and evicts them only when it can’t.
  • InPlace never evicts: when a resize can’t happen, it waits and retries.

The HPA

The HPA is built into Kubernetes: the HorizontalPodAutoscaler object in autoscaling/v2, run by a control loop in the kube-controller-manager. Every 15 seconds by default, it reads a metric. Then it changes the replica count of a Deployment, StatefulSet or other scalable workload to hold that metric at a target.

For a CPU or memory utilization target, the metric is usage as a percentage of the request. The HPA reads it from the resource metrics API, metrics.k8s.io, which Metrics Server usually serves. Its core rule is:

desiredReplicas = ceil(currentReplicas × currentMetric ÷ targetMetric)

For the second Deployment above, that’s ceil(4 × 140 ÷ 70) = 8 pods. By default, the HPA skips any change while the ratio of current to target stays within 0.1 of 1.0. It scales down only after a 300-second stabilization window.

Custom and external metrics work too. On a CPU or memory utilization target, every decision divides by the pod’s request.

Requests decide node count

The scheduler places pods by their CPU and memory requests, not their use. A pod fits a node only if its requests, plus those already there, fit the node’s capacity. So a request set “to be safe” at four times real use keeps you paying for nodes that do almost nothing.

Node autoscalers such as the Cluster Autoscaler and Karpenter count the same way. They add nodes to fit requests and consolidate on requests, not real use. A request set too high can stop a node from being removed.

Limits are a separate control: the kernel throttles a container at its CPU limit and may OOM-kill one that goes past its memory limit.

HPA and VPA together

The HPA and VPA work together only on different signals. On the same CPU or memory metric, they feed each other. Each request change from the VPA looks like a load change to the HPA, so the pod count follows the VPA, not real load.

A smaller request makes the HPA add a pod for the same load Four step boxes in a two by two grid, read clockwise. Top left: pod uses 200m of a 500m request, 40%. An arrow labelled VPA sizes the request to use leads to the top right: VPA sets the request to 250m, and the same 200m reads as 80%. An arrow labelled 80% is over the 70% target leads down to the bottom right: HPA adds a pod, 4 to 5 pods. An arrow labelled load spreads over 5 pods leads to the bottom left: each pod uses less, 800m divided by 5 is 160m. A highlighted arrow leaves the bottom left box and returns into the top right box, labelled VPA shrinks the request again. Under the grid: total load stays 800m. A smaller request makes the HPA add a pod for the same load Pod uses 200mof a 500m request40%VPA sets therequest to 250msame 200m reads as 80%HPA adds a pod4 → 5 podsEach pod uses less800m ÷ 5 = 160mrequest to useVPA sizes the80% is overthe 70% targetover 5 podsload spreadsVPA shrinks the request againTotal load stays 800m
Illustration: the worked example, with an HPA minimum of 4 pods and a 70% CPU target.

The same loop happens on memory. The VPA project says not to pair the VPA with an HPA on the same resource metric, CPU or memory. Microsoft’s AKS documentation doesn’t recommend that pair either.

How to run both

The VPA project allows the first two patterns, which use different signals. The third keeps the VPA out of running pods:

  1. Let the VPA size memory only, with controlledResources: ["memory"], and let the HPA scale on CPU.
  2. Scale the HPA on a custom or external metric, such as requests per second or queue length, while the VPA sizes CPU and memory.
  3. Keep the VPA in Off mode, read its targets, and set requests yourself when you deploy.

The first pattern, on Kubernetes 1.33 or later:

apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
  name: <app>-vpa
spec:
  targetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: <app>
  updatePolicy:
    updateMode: "InPlaceOrRecreate"
  resourcePolicy:
    containerPolicies:
    - containerName: "<container>"
      controlledResources: ["memory"]
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: <app>
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: <app>
  minReplicas: 2
  maxReplicas: 10
  metrics:
  - type: Resource
    resource:
      name: cpu
      target:
        type: Utilization
        averageUtilization: 70

On an older cluster or VPA release, use Recreate in place of InPlaceOrRecreate. In the first and third patterns, the CPU request under the HPA is still yours to set.

Set requests first

The HPA is only as accurate as the request it divides by, so work in this order:

  1. Size requests to measured use. Take a high percentile of CPU over several days plus headroom, and the peak of memory. Leave limits alone until you know why they were set.
  2. Then set the HPA target. With requests near real use, a 70% target means 70% of what a pod really needs.
  3. Then let the node autoscaler remove spare nodes. Smaller requests fit on fewer nodes, and the Cluster Autoscaler or Karpenter can remove the empty ones.

Where you pay for nodes, smaller requests alone don’t reduce cost. Cost falls when a node is removed.

Where Coral fits

Coral is Kubernetes cost optimization for AKS and EKS. It does the VPA’s job without the VPA, and it works with your HPA.

  • Requests. Coral rebalances CPU and memory requests to real use, with its own recommender and webhook. Your manifests stay as they are, and new pods start at the new size. Running pods are resized in place on Kubernetes 1.33 or later, or else restarted one at a time within their PodDisruptionBudgets.
  • Your VPAs. With automation on, Coral switches an active VPA to Off. It restores the VPA when you switch automation off or disconnect.
  • Your HPA. The HPA decides how many pods run, and Coral decides how big each pod is. For a CPU-based HPA, Coral replays past load through that HPA’s own settings before it picks a request. A smaller request wins only if its saving beats the cost of unserved load and extra scaling. While the HPA is scaling and below its max, Coral holds back its CPU raises and pauses pod replacements until every pod is Ready.
  • HPAs it manages. With automation on, Coral creates an HPA for an eligible Deployment or Argo Rollout that has none, with minReplicas of 2 or more. Every built-in policy except read-only does this. On an HPA nothing else manages, Coral can take over: it keeps your minReplicas and only raises maxReplicas. Workload optimization never changes HPAs from Helm, KEDA or kubectl apply, or HPAs whose bounds Argo CD or Flux own.
  • Nodes. Coral drains and removes the nodes you don’t need, one at a time. Node optimization is on from install, and you can limit it to chosen node pools.
  • Opt-in. Pod sizing waits for you: Coral only recommends until you switch on automation for a policy or a workload.

On our own AKS development cluster, Coral removed a spare worker and rebalanced the requests of 14 apps. Then it swapped the remaining worker for a cheaper machine of the same size. Eight days after we connected it, the cluster’s machines cost $154.76 a month instead of $368.65, 58% less.

Kubernetes optimization with Coral Estimate your saving

Find your own number

One command in your terminal. One PDF report with your estimated saving at list price.

Estimate your saving
Talk to the builders

Thirty minutes with the people who build Coral.

Book a demo (opens in a new tab)

Or write to founders@zoorik.com