Vertical Pod Autoscaler (VPA) Basics
What you'll learn: How VPA automatically rightsizes container resource requests and limits to match actual usage patterns.
The Core Idea
While Horizontal Pod Autoscaler (HPA) adds more pod replicas, Vertical Pod Autoscaler (VPA) adjusts the CPU and memory requests/limits of existing pods. Think of HPA as hiring more workers, while VPA is giving each worker better tools and resources based on what they actually need.
VPA watches your pods' actual resource consumption over time and either recommends or automatically applies optimized resource requests and limits. This prevents both over-provisioning (wasting cluster resources) and under-provisioning (causing performance issues or OOMKills).
VPA Components
VPA consists of three parts:
- Recommender: Analyzes historical resource usage and generates recommendations
- Updater: Decides which pods need updates based on recommendations
- Admission Controller: Applies resource changes when pods are created or restarted
VPA Modes of Operation
VPA operates in three modes:
Off Mode
VPA only provides recommendations without making changes. You can view suggestions via kubectl describe vpa but must manually update deployments. Perfect for testing or cautious production environments.
Initial Mode
VPA sets resource requests only when pods are first created, not on running pods. Good for stateful applications where restarts are costly.
Auto Mode
VPA automatically updates resource requests by evicting and recreating pods with new values. The most hands-off approach, but requires your application to handle restarts gracefully.
When to Use VPA
VPA shines when workload resource needs are unpredictable or change over time. It's particularly useful for applications without clear usage patterns.
Key Takeaway: VPA optimizes individual pod resource allocation through three modes—Off (recommendations only), Initial (set-once), and Auto (continuous adjustment)—helping you rightsize containers based on actual usage rather than guesswork.