Course contentsShow
← Cloud and Infrastructure
Lesson 1457 of 2,98929. Kubernetes ObservabilityFree lesson

VPA and HPA Interaction

Understanding compatibility challenges between VPA and HPA, strategies for using both, and current limitations.

VPA and HPA Interaction

What You'll Learn

You'll understand why VPA and HPA can conflict when used together and what strategies exist to manage them safely.

The Core Challenge

Both Vertical Pod Autoscaler (VPA) and Horizontal Pod Autoscaler (HPA) attempt to optimize resource usage, but in fundamentally different ways. HPA scales by adding or removing pods, while VPA adjusts the resource requests of existing pods. When both operate on the same workload, they can create conflicts.

The Problem

Imagine two mechanics working on the same car engine simultaneously—one trying to replace the spark plugs while the other adjusts the timing belt. They'll get in each other's way. Similarly:

  • VPA evicts pods to apply new resource requests, which HPA interprets as pods disappearing
  • HPA adds replicas based on CPU/memory usage, but VPA might be changing those very thresholds
  • The result: unpredictable scaling behavior, potential oscillation, and resource waste

Current Limitations

As of now, VPA and HPA cannot safely target the same resource metrics (CPU or memory). The Kubernetes project explicitly discourages this configuration because:

  • VPA restarts pods to change requests, triggering HPA recalculations
  • Both controllers operate on different timescales, creating feedback loops
  • No built-in coordination mechanism exists between them

Strategies for Using Both

You can use VPA and HPA together if you separate their concerns:

  • HPA on custom/external metrics (e.g., request queue length, business metrics) while VPA manages CPU/memory
  • VPA in recommendation mode only, where you manually apply its suggestions without auto-updates
  • Different workloads entirely—VPA for stateful sets, HPA for stateless services

Key Takeaway: VPA and HPA conflict when targeting the same metrics; use them on separate metrics or workloads, or run VPA in recommendation-only mode to avoid unpredictable scaling behavior.