Services

Resources

Company

Cluster Autoscaler

A cluster autoscaler is a component that changes the number of nodes in a Kubernetes cluster. It adds a node when pods are stuck in Pending because no node has room for them, and removes a node when its pods fit elsewhere. The best known is the open source Kubernetes Cluster Autoscaler, which resizes cloud node groups.

How it works

The autoscaler decides from pod resource requests, not live CPU usage. It scans the cluster every 10 seconds by default.

  • Scale up: 5 pending pods each request 3 vCPU. Nodes have about 7.5 vCPU free for pods, so 2 pods fit per node and the autoscaler asks the node group for 3 more nodes.

  • Scale down: a node whose pods request less than 50% of its capacity for 10 minutes is a candidate. The autoscaler drains it if its pods can move.

Why it matters in production

The Horizontal Pod Autoscaler creates pods, but they only run if a node exists. The cluster autoscaler closes that gap and removes idle capacity you would otherwise pay for. New nodes take minutes to boot, so spiky services still need some headroom.

See also

On the One2N blog

Further reading

Comic about cluster autoscaler: a traffic spike leaves 5 pods Pending because nodes are full; the autoscaler reads requests, fits 2 pods per node and adds 3 nodes; at night an underused node is drained and removed, and Noor and Asha note idle nodes stop costing money.