Skip to Content

When do you pick HPA vs cluster-autoscaler?

Category: DevOps & Deployment

Answer

HPA (Horizontal Pod Autoscaler) adds pods within a cluster based on CPU/Memory/custom metrics. Cluster-autoscaler adds NODES when pods can’t fit. Use both in a chain: HPA scales pods, cluster-autoscaler scales nodes when HPA can’t schedule. The CA lags (about a minute) so HPA tolerance must absorb one burst cycle.

Concrete examples from the fca project context

Example 1

HPA: scale on CPU > 70% or queue depth > N; min=3, max=50.

Example 2

Cluster-autoscaler: scale nodes when pending pods > 0 for > 30s.

Example 3

Use topology spread constraints so new pods land in different zones.

Data flow / flow chart

load -> HPA -> more pods -> pending -> Cluster Autoscaler -> more nodes
  Configure max_pods_per_node for buffer

Takeaway

HPA + CA is a chain, not a choice. Get HPA tolerance right and CA handles the rest.