← All Tools

Kubernetes HPA Calculator & Simulator

Reproduce the exact decision the HorizontalPodAutoscaler controller makes each control-loop tick — desiredReplicas = ceil(currentReplicas × currentValue / targetValue), guarded by the --horizontal-pod-autoscaler-tolerance band, minReplicas / maxReplicas clamps, and the v2 behavior.scaleUp / scaleDown stabilization windows and per-policy rate limits (Pods or Percent per periodSeconds). Paste a load timeline — the tool ticks through every 15-second sync and shows the replica count evolve.

HPA spec

CPU averageUtilization=50% Requests /s target=200 Queue depth per pod=10 Memory averageUtilization=80%

Scale behavior (v2)

scaleUp

scaleDown

A policy of 0 is treated as "no limit for this policy". When both a Pods and a Percent policy are set, selectPolicy=Max (the default for scale-up) picks the larger permitted change and Min picks the smaller (the default for scale-down, so a single fat pod won't allow a big drop).

Single-tick calculator


Timeline simulator

Flat → surge → flat Sawtooth Single spike Slow ramp-down

Reference: how the HPA decides

  1. Each sync period (default 15 s), for every ready pod, the controller reads the current metric value.
  2. Compute the average per pod and the ratio current / target.
  3. If |ratio − 1| ≤ tolerance (default 0.10), do nothing.
  4. Otherwise, desired = ceil(current × ratio).
  5. Clamp to [minReplicas, maxReplicas].
  6. Apply the v2 behavior: scale-up uses the last scaleUp.stabilizationWindowSeconds of desireds (min), scale-down uses the max. Then apply per-policy rate caps (Pods and Percent), pick according to selectPolicy.
  7. Emit the final desiredReplicas; the deployment does the rest.

Defaults: sync period 15 s, tolerance 0.10, scale-up unlimited + 0 s stabilization, scale-down 100%/60 s + 300 s stabilization. Kubernetes 1.29+ can tune tolerance per-HPA via spec.behavior.scaleUp.tolerance.