Skip to main content
Running workloadsLesson 11 of 14

Automatic Pod Sizing (VPA)

HPA changes the number of pods; VPA changes the size of each pod. Follow what happens behind the scenes when you attach a VPA to a workload.

Requests in YAMLOriginal
Actual pod requestsOriginal
Update mode—
MetricsCollects usageRecommenderComputes targetsVPAUpdate modeHPAPod countUpdaterReplaces podskubectlReads actual valuesDeploymentYAML specapi-1Original sizeapi-2New sizeCreate pod
RequestResponse / reportWatchAppears in a later step

What you will learn

  • The difference between HPA (count) and VPA (size)
  • How the Recommender derives targets from usage history
  • The difference between recommend-only and apply modes
  • Why the YAML and the actual pod values look different

Try it yourself​

kubectl get vpa -A # Attached VPAs and their update modes
kubectl describe vpa <name> # Recommendation
kubectl get pod <pod> -o jsonpath='{.spec.containers[*].resources}' # Actual pod values
kubectl get hpa -A # Is an HPA attached to the same target?

Check yourself

  1. Nobody changed the Deployment YAML, but a running pod has different CPU and memory requests. What is the most likely reason?
  2. You attach a VPA in recommend-only mode (Off). What happens to the pods?
  3. An HPA scales pods on CPU, and you want to add a VPA in apply mode. What should you avoid?

Further reading: Workload autoscaling · Vertical Pod Autoscaler (GitHub) · Resource management for containers · Scaling with Load (HPA)