Course contentsShow
← Cloud and Infrastructure
Lesson 1483 of 2,98930. Managed Kubernetes ServicesFree lesson

GKE Cluster Autoscaling

Configuring Cluster Autoscaler to automatically adjust node pool sizes based on workload resource demands.

GKE Cluster Autoscaling

You'll learn how to configure GKE's Cluster Autoscaler to automatically grow or shrink your node pools based on actual workload demands, ensuring you only pay for the compute resources you need.

What Is Cluster Autoscaling?

Cluster Autoscaler is a GKE feature that monitors your workloads and automatically adjusts the number of nodes in your node pools. Think of it like a smart thermostat for your infrastructure: when Pods can't be scheduled due to insufficient resources, it adds nodes; when nodes sit mostly idle, it removes them. This differs from Horizontal Pod Autoscaler (which scales Pods) — Cluster Autoscaler scales the infrastructure those Pods run on.

How It Works

When you enable Cluster Autoscaler, GKE watches for:

  • Scale-up triggers: Pods stuck in "Pending" state because no node has enough CPU, memory, or other resources
  • Scale-down triggers: Nodes running below a utilization threshold (typically 50%) for a sustained period, with workloads that can be safely moved elsewhere

The autoscaler respects your configured minimum and maximum node counts per pool, ensuring you maintain baseline capacity while capping costs.

Enabling on Node Pools

You configure autoscaling per-node-pool with minimum and maximum bounds:

gcloud container clusters create my-cluster \
  --enable-autoscaling \
  --min-nodes 1 \
  --max-nodes 10 \
  --num-nodes 3

Or update an existing pool:

gcloud container node-pools update default-pool \
  --cluster my-cluster \
  --enable-autoscaling \
  --min-nodes 2 \
  --max-nodes 8

The autoscaler works seamlessly with GKE Release Channels, maintaining compatibility during automatic upgrades.

Key Takeaway: GKE Cluster Autoscaler automatically adjusts node pool sizes based on Pod scheduling needs and resource utilization, optimizing costs while ensuring workload capacity.