Calculate the ideal Horizontal Pod Autoscaler target utilization and replica range.
The Horizontal Pod Autoscaler computes desired replicas as desiredReplicas = ceil(currentReplicas × (currentMetricValue / desiredMetricValue)), then clamps the result to the configured minReplicas/maxReplicas range. This mirrors the exact formula the Kubernetes HPA controller uses for the resource-metric algorithm, letting you predict scaling behavior before it happens in the cluster.
desiredReplicas = clamp(ceil(currentReplicas × (currentCPU% / targetCPU%)), min, max)
The HPA has built-in stabilization windows and tolerance (default ±10%) to avoid thrashing — small deviations from target within that tolerance band do not trigger a scaling event.
The HPA clamps the desired count to maxReplicas and the pods will remain under-provisioned relative to the target utilization until you raise the ceiling or the load decreases.
The same ratio formula applies to any metric type the HPA supports (CPU, memory, custom metrics via adapters), as long as you're using the average utilization (Value) metric target type.
Target below the level where response times start degrading, typically 50-70% for CPU, to leave headroom for scale-up delay while new pods start and pass readiness checks.