What Is a Horizontal Pod Autoscaler?
A horizontal pod autoscaler (HPA) is a Kubernetes controller that automatically scales the replica count of a deployment or statefulset to match demand. It periodically compares a target metric, such as average CPU utilization, against the current value and adjusts the number of pods accordingly. The HPA keeps utilization near a desired threshold without manual intervention.
Why it matters
Manually tuning replica counts is slow and tends to over-provision for safety. An HPA reacts to real load so a service scales out under traffic spikes and back in when demand falls, balancing latency against cost.
What it scales on
- CPU and memory utilization targets
- Custom and external metrics via the metrics API
- Per-pod averages compared to a desired value