Skip to content
Optimal Lab

DevOps · interactive

Pod autoscaling (HPA)

The Horizontal Pod Autoscaler compares average CPU use with each pod's request (500m here) and aims for 60%. Its rule is one line: desired = ceil(current pods × current% ÷ target%). Change the total CPU the app needs.

  1. 3 pods at 200% → ceil(3 × 200 ÷ 60) = 10 → 10
  2. 10 pods at 60% → ceil(10 × 60 ÷ 60) = 10 → 10

10 pods at ~60% of their CPU request

Settles at 10 pods, close to the 60% target, leaving headroom for spikes.

  1. 1

  2. 2

    Twice the target utilisation means twice the pods, recomputed every 15 seconds from metrics-server.

    Custom metrics (queue depth, RPS) work the same way.

  3. 3

  4. 4

In production

Tools and technologies

The HPA is built into Kubernetes.

Not tied to one language — use these names when you search docs or design a system.