What Is Kubernetes HPA and How Can It Help You Save on the Cloud? Kubernetes Horizontal Pod Autoscaler (HPA) automatically adjusts pod replica counts based on real-time demand, addressing the industry-wide issue of average CPU utilization of just 8% across production clusters. By dynamically scaling resources, HPA helps reduce cloud costs and prevent over-provisioning during off-peak hours. Kubernetes HPA Horizontal Pod Autoscaler automatically scales pod replicas up or down based on real demand. Despite years of Kubernetes maturity, fleet-wide CPU utilization still averages just 8% across production clusters Cast AI 2026 State of Kubernetes Optimization Report https://cast.ai/reports/state-of-kubernetes-optimization/ , across tens of thousands of clusters on AWS, GCP, and Azure . Overprovisioning is not a configuration problem. It is a structural one. HPA is one of the tools that helps close the gap. If your workloads run at fixed replica counts regardless of traffic, you’re almost certainly over-provisioning during off-peak hours and potentially under-provisioning during peaks. This guide covers how HPA works, how to configure it with the current autoscaling/v2 API, which metrics to scale on, and how it connects to real cloud cost reduction. We also cover the common mistakes that cause HPA to either flap or silently fail to scale at all. Key Takeaways - Kubernetes HPA automatically adjusts pod replica counts based on CPU, memory, or custom metrics, checking every 15 seconds. - The autoscaling/v2 API is the current standard; autoscaling/v1 is deprecated and limits you to a single CPU metric. - Fleet-wide average CPU utilization is just 8% across production clusters Cast AI 2026 State of Kubernetes Optimization Report https://cast.ai/reports/state-of-kubernetes-optimization/ ; HPA is the mechanism that reclaims that wasted spend. - Scale-down uses a 5-minute stabilization window by default; scale-up is immediate. Both are tunable. - HPA and VPA conflict when both target CPU or memory; understand the safe co-use rules before combining them. - KEDA extends HPA with over 60 external metric sources, including Prometheus, SQS, and Kafka, and enables scale-to-zero. What Is Kubernetes HPA? Kubernetes HPA Horizontal Pod Autoscaler is a built-in control-plane controller that automatically increases or decreases the number of pod replicas in a Deployment, StatefulSet, or ReplicaSet based on observed metrics. It checks metrics every 15 seconds and adjusts replica counts to keep average utilization near a configured target. HPA works with Deployments, ReplicaSets, and StatefulSets. For StatefulSets, ensure pods are stateless peers or that the application handles per-pod state such as sharded or quorum-aware services . Naive horizontal scaling of a stateful database can cause split-brain or quorum loss. HPA does not apply to DaemonSets, which run exactly one pod per node by definition. For a broader view of Kubernetes autoscaling strategies, see the Cast AI guide to Kubernetes autoscaling for cloud cost optimization https://cast.ai/blog/guide-to-kubernetes-autoscaling-for-cloud-cost-optimization/ . HPA addresses a fundamental problem with static deployments: traffic is not constant. A fixed replica count either wastes money during quiet periods or hits a ceiling during spikes. HPA removes both failure modes by treating replica count as a continuous variable, not a static setting. How Kubernetes HPA Works Understanding the internal mechanics of HPA helps you configure it correctly and diagnose failures when scaling doesn’t behave as expected. The HPA Control Loop The HPA Control Loop is the core algorithm that drives all scaling decisions. Every 15 seconds configurable via --horizontal-pod-autoscaler-sync-period on the controller manager , the HPA controller executes this sequence: - Poll the appropriate metrics API for current metric values across all target pods. - Compute the desired replica count using the formula: desiredReplicas = ceil currentReplicas × currentMetricValue / desiredMetricValue - Apply a tolerance threshold: if the ratio falls within ±10% of 1.0, no scaling action occurs. - Check the stabilization window to prevent thrashing: scale-up has a 0-second window immediate and scale-down has a 300-second window 5 minutes by default. - Enforce minReplicas and maxReplicas bounds. - Issue the scale command to the target workload. For example, if a Deployment has 4 replicas, average CPU utilization is 80%, and the target is 60%, HPA computes: ceil 4 × 80 / 60 = ceil 5.33 = 6 . Two replicas are added. This formula is sourced from the Kubernetes official documentation on Horizontal Pod Autoscaling https://kubernetes.io/docs/concepts/workloads/autoscaling/horizontal-pod-autoscale/ . The tolerance band prevents unnecessary churn when metrics hover near the threshold. Without it, HPA would continuously add and remove replicas in response to minor fluctuations. Metrics Server and Metrics Availability HPA pulls metrics from three APIs depending on the metric type: metrics.k8s.io : CPU and memory served by metrics-server custom.metrics.k8s.io : custom per-pod or per-object metrics served by prometheus-adapter or similar external.metrics.k8s.io : metrics from outside the cluster served by KEDA or a custom adapter For CPU and memory scaling, metrics-server must be deployed and healthy. Verify it with kubectl top pods . If that command fails, HPA will show