Horizontal Pod Autoscaler
Understand HPA for scaling Pod replicas based on CPU, memory, custom metrics, and production traffic behavior.
Last reviewed: June 2026
🔍 What Is It?
Horizontal Pod Autoscaler is a Kubernetes controller that scales supported workloads such as Deployments and StatefulSets by adjusting replica count.
🎯 Why Do We Need It?
Applications experience changing load. HPA helps add replicas during demand and reduce replicas when demand drops.
Common developer mistakes:
- →Treating Kubernetes YAML as copy-paste configuration instead of production architecture
- →Ignoring requests, limits, health probes, security context, and rollout behavior
- →Debugging only the Pod while forgetting Services, DNS, NetworkPolicies, nodes, and admission controls
- →Manually changing live objects without updating Git or infrastructure automation
🏗️ What Happens in Real Projects?
An API Deployment scales from 4 to 30 replicas based on request latency or CPU. Cluster Autoscaler adds nodes if the cluster lacks capacity for new Pods.
⚙️ How It Works
HPA queries metrics APIs, compares current metrics to target values, and updates the workload's scale subresource. Metrics Server supports resource metrics; adapters support custom and external metrics.
💻 Example
HPA manifest — Scaling a Deployment by CPU utilization.
🤔 Common Confusions
❓ Does HPA add nodes?
No. HPA adds Pods. Cluster Autoscaler adds nodes when Pods cannot be scheduled.
❓ Can HPA work without requests?
CPU utilization scaling requires CPU requests to calculate utilization.
❓ Is CPU always the best metric?
No. Request rate, queue depth, or latency can be better for some applications.
🚨 Common Production Issues
**Missing CPU requests** breaks resource utilization scaling.
**Scaling on wrong metric** adds replicas without fixing the bottleneck.
**Too low maxReplicas** caps scale during traffic spikes.
**No cluster capacity** leaves scaled Pods pending.
✅ Best Practices
Set accurate resource requests
Choose metrics that reflect real demand
Load test HPA behavior
Pair HPA with Cluster Autoscaler
Use stabilization windows to reduce flapping
🏛️ Architect's Note
HPA is not magic capacity. It is a feedback loop. Good metrics and resource requests decide whether that loop helps or hurts.
💬 Frequently Asked Questions
🎯 Key Takeaways
🔗 Related Topics
🎯 Practice this topic in interviews
↗ Where this topic fits
Kubernetes Technology Guide
Return to the Kubernetes learning hub.
Cloud Engineer Career Path
A practical route through cloud fundamentals, AWS services, containers, delivery, and architecture-focused interview preparation.
DevOps Engineer Career Path
A structured route through automation, container delivery, platform operations, production support, and interview preparation.
Sources
Sources / References
Use these Kubernetes references to verify the concept in official docs and continue into the most relevant SplashRide pages.
Official documentation
Related SplashRide pages
SplashRide Kubernetes learning path
Browse the full Kubernetes topic collection and learning order on SplashRide.
Kubernetes Interview Prep
Practice Kubernetes interview questions and scenario-based answers.
Cloud Engineer Career Path
A practical route through cloud fundamentals, AWS services, containers, delivery, and architecture-focused interview preparation.
DevOps Engineer Career Path
A structured route through automation, container delivery, platform operations, production support, and interview preparation.
Cluster Autoscaler
Learn Cluster Autoscaler for adding and removing worker nodes based on unschedulable Pods and unused capacity.
Metrics Server
Learn Metrics Server for Kubernetes resource metrics, kubectl top, HPA support, and its limits compared with full observability systems.