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

Four-panel comic about Cluster autoscaler: The HPA asks for 5 more pods but every node is full. The pods sit in Pending; The cluster autoscaler sees pending pods and reads their requests, not live CPU; Each pod requests 3 vCPU and a node has about 7.5 free, so 2 fit per node: 3 new nodes; At...