Skip to content

Cluster Autoscaling

Cluster autoscaler automatically adjusts the number of nodes in a cluster based on resource demand.

Cluster Autoscaling
Nodes auto-scale based on demand

Mental Model

Like a building that adds more floors when tenants need more space. When pods can't be scheduled (pending), the autoscaler adds more nodes. When nodes are underutilized, it removes them to save costs.

YAML Example

apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
  name: web-hpa
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: web
  minReplicas: 1
  maxReplicas: 10
  targetCPUUtilizationPercentage: 50

# Cluster autoscaler runs separately
# Configuration is cluster-specific

Common Misconceptions

  • ✗Autoscaler adds pods - FALSE: Cluster autoscaler adds nodes (HPA adds pods)
  • ✗Autoscaling is instant - FALSE: Takes time to provision nodes
  • ✗Autoscaler never removes nodes - FALSE: Removes underutilized nodes

Key Takeaways

  • • Cluster autoscaler automatically adjusts the number of nodes in a cluster based on resource demand.
  • • Like a building that adds more floors when tenants need more space. When pods can't be scheduled (pe...
  • • Check the YAML example for implementation details
  • • Be aware of the common misconceptions listed above
Kubernetes Cosmos•An interactive learning experience
Built by GLM 4.7