Sub topic 18
Choosing between Cluster Autoscaler and Karpenter
This chapter assumes you know Pending pods, resource requests, node groups, and the basics of both autoscalers from earlier chapters. It covers how to pick one and how to move from one to the other.
The core difference
Cluster Autoscaler (CA) resizes node groups you define in advance. Each group is an Auto Scaling group with a fixed instance type or a small set of types. CA simulates scheduling against those groups and raises the desired size of one.
Karpenter has no node groups. It reads the Pending pods, picks instance types that fit them, and launches EC2 instances directly. Its NodePool and EC2NodeClass objects limit what it may launch.
Decision criteria
| Concern | Cluster Autoscaler | Karpenter |
|---|---|---|
| Node shape | Fixed per node group | Chosen per launch from NodePool requirements |
| Cloud support | Many providers | AWS is the mature target |
| Scale-down | Removes under-used nodes | Consolidation can also replace nodes with cheaper ones |
| Node upgrades | You roll the node group | Drift and expiration replace nodes automatically |
| Mixed workloads | Needs many node groups | One NodePool can cover many shapes |
| Operational model | Familiar, well documented | Newer, more settings to learn |
Choose Cluster Autoscaler when you run outside AWS, when your workloads fit a few stable node shapes, or when your platform already manages Auto Scaling groups and you want few changes. Choose Karpenter on AWS when workloads vary in size, when you want Spot diversification and cost-driven consolidation, or when the number of node groups has become hard to manage.
Migrating from Cluster Autoscaler
Move gradually. Both can run at once if they manage different nodes.
- Install Karpenter and create an EC2NodeClass and a NodePool. Set a CPU limit low enough to cap risk.
- Keep CA running, but remove the auto-discovery tags from one node group, or scale that group down.
- Move a test workload to Karpenter nodes with a node selector or by tainting the old nodes. Confirm that pods schedule and that nodes appear.
- Add PodDisruptionBudgets before you drain old nodes, so evictions do not take down a service.
- Drain the old nodes group by group. Karpenter launches replacements as pods go Pending.
- When no group needs CA, remove CA.
Run Karpenter's own controller on capacity that it does not manage, such as a small managed node group or Fargate. Otherwise Karpenter could remove the node it runs on.
Common mistakes
- Choosing Karpenter only for speed, without setting NodePool limits. A wrong constraint can launch large or costly nodes.
- Leaving out PodDisruptionBudgets. Consolidation and scale-down both evict pods.
- Mixing both autoscalers on one node pool.
Exercise
Your cluster runs on AWS with a wide mix of pod sizes, and you maintain 14 node groups to cover them. Which autoscaler fits better, and what safeguard should you set on the first NodePool?
Show answer
Karpenter fits better, because one NodePool can cover many instance shapes and replace the many node groups. Set a limits value, such as a CPU cap, on the first NodePool to bound cost while you migrate.