Skip to main content

Overview

The Cluster Autoscaler automatically adjusts the number of nodes in your EKS cluster based on pending pods and resource utilization. When combined with HPA, it provides end-to-end autoscaling from application load to infrastructure capacity.

How It Works

Flow:
  1. HPA scales pods based on metrics
  2. New pods enter “Pending” state (insufficient resources)
  3. Cluster Autoscaler detects pending pods
  4. Adds nodes to Auto Scaling Group
  5. Pods scheduled on new nodes
  6. After scale-down period, removes underutilized nodes

Prerequisites

1

IAM Role

Create IAM role with autoscaling permissions (see IAM & IRSA)
2

Node Group Tags

Ensure node groups have proper tags:
3

Service Account

IRSA-enabled service account for Cluster Autoscaler

Installation

Using Helm Chart

The Smallest Self-Host chart includes Cluster Autoscaler as a dependency:
values.yaml
Deploy:

Standalone Installation

Install Cluster Autoscaler separately:

Configuration

Auto-Discovery

Auto-discover Auto Scaling Groups by cluster name:

Manual Configuration

Explicitly specify Auto Scaling Groups:

Scale-Down Configuration

Control when and how nodes are removed:
Parameters:
  • scale-down-delay-after-add: Wait time after adding node before considering scale-down
  • scale-down-unneeded-time: How long node must be underutilized before removal
  • scale-down-utilization-threshold: CPU/memory threshold (0.5 = 50%)
  • max-graceful-termination-sec: Max time for pod eviction

Node Group Priorities

Scale specific node groups first:
Priorities:
  • Higher number = higher priority
  • Regex patterns match node group names
  • Useful for preferring spot instances

Verify Installation

Check Cluster Autoscaler Pod

Check Logs

Look for:

Verify IAM Permissions

Should show no permission errors.

Testing Cluster Autoscaler

Trigger Scale-Up

Create pods that exceed cluster capacity:
Watch nodes:
Watch Cluster Autoscaler:
Expected behavior:
  1. Pods enter “Pending” state
  2. Cluster Autoscaler detects pending pods
  3. Logs show: “Scale-up: setting group size to X”
  4. New nodes appear in kubectl get nodes
  5. Pods transition to “Running”

Trigger Scale-Down

Delete test pods:
After scale-down-unneeded-time (default 10 minutes):
  1. Cluster Autoscaler marks underutilized nodes
  2. Drains pods gracefully
  3. Terminates EC2 instances
  4. Node count decreases

GPU Node Scaling

Configure GPU Node Groups

Tag GPU node groups for autoscaling:
cluster-config.yaml

Prevent Cluster Autoscaler on GPU Nodes

Run Cluster Autoscaler on CPU nodes to avoid wasting GPU:
values.yaml

Scale to Zero

Allow GPU nodes to scale to zero during off-hours:
Cluster Autoscaler will:
  • Add GPU nodes when Lightning ASR pods are pending
  • Remove GPU nodes when all GPU workloads complete
First startup after scale-to-zero takes longer (node provisioning + model download).

Spot Instance Integration

Mixed Instance Groups

Use spot and on-demand instances:
cluster-config.yaml
Configuration:
  • Base capacity: 1 on-demand node always
  • Additional capacity: 20% on-demand, 80% spot
  • Multiple instance types increase spot availability

Handle Spot Interruptions

Configure Cluster Autoscaler for spot:
Add AWS Node Termination Handler:

Advanced Configuration

Multiple Node Groups

Scale different workloads independently:

Scale-Up Policies

Control scale-up behavior:

Resource Limits

Prevent runaway scaling:

Monitoring

CloudWatch Metrics

View Auto Scaling Group metrics in CloudWatch:
  • GroupDesiredCapacity
  • GroupInServiceInstances
  • GroupPendingInstances
  • GroupTerminatingInstances

Kubernetes Events

Cluster Autoscaler Status

Grafana Dashboard

Import Cluster Autoscaler dashboard: Dashboard ID: 3831 See Grafana Dashboards

Troubleshooting

Nodes Not Scaling Up

Check pending pods:
Check Cluster Autoscaler logs:
Common issues:
  • Max nodes reached (max-nodes-total)
  • IAM permission denied
  • Auto Scaling Group at max capacity
  • Node group not tagged properly

Nodes Not Scaling Down

Check node utilization:
Check for blocking conditions:
Common causes:
  • Pods without PodDisruptionBudget
  • Pods with local storage
  • System pods (unless skip-nodes-with-system-pods: false)
  • Nodes below utilization threshold

Permission Errors

Check service account:
Verify IAM role:
Update IAM policy if needed (see IAM & IRSA)

Best Practices

Always tag Auto Scaling Groups:
Configure appropriate min/max for each node group:
Protect critical workloads during scale-down:
Track scaling decisions in GrafanaSet alerts for scale failures
Periodically test scale-up and scale-down:
Watch for proper node addition/removal

What’s Next?

HPA Configuration

Configure pod-level autoscaling

Metrics Setup

Set up Prometheus metrics

Grafana Dashboards

Visualize autoscaling behavior