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:- HPA scales pods based on metrics
- New pods enter “Pending” state (insufficient resources)
- Cluster Autoscaler detects pending pods
- Adds nodes to Auto Scaling Group
- Pods scheduled on new nodes
- 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
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:scale-down-delay-after-add: Wait time after adding node before considering scale-downscale-down-unneeded-time: How long node must be underutilized before removalscale-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:- Higher number = higher priority
- Regex patterns match node group names
- Useful for preferring spot instances
Verify Installation
Check Cluster Autoscaler Pod
Check Logs
Verify IAM Permissions
Testing Cluster Autoscaler
Trigger Scale-Up
Create pods that exceed cluster capacity:- Pods enter “Pending” state
- Cluster Autoscaler detects pending pods
- Logs show: “Scale-up: setting group size to X”
- New nodes appear in
kubectl get nodes - Pods transition to “Running”
Trigger Scale-Down
Delete test pods:scale-down-unneeded-time (default 10 minutes):
- Cluster Autoscaler marks underutilized nodes
- Drains pods gracefully
- Terminates EC2 instances
- 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:- 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
- 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: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:GroupDesiredCapacityGroupInServiceInstancesGroupPendingInstancesGroupTerminatingInstances
Kubernetes Events
Cluster Autoscaler Status
Grafana Dashboard
Import Cluster Autoscaler dashboard: Dashboard ID: 3831 See Grafana DashboardsTroubleshooting
Nodes Not Scaling Up
Check pending pods:- 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:- 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:Best Practices
Tag Node Groups Properly
Tag Node Groups Properly
Always tag Auto Scaling Groups:
Set Realistic Limits
Set Realistic Limits
Configure appropriate min/max for each node group:
Use PodDisruptionBudgets
Use PodDisruptionBudgets
Protect critical workloads during scale-down:
Monitor Scaling Events
Monitor Scaling Events
Track scaling decisions in GrafanaSet alerts for scale failures
Test Regularly
Test Regularly
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

