2026-11-19 · 8 min read
Autoscaling Done Right: HPA, KEDA, and Karpenter
Kubernetes autoscaling has three layers that work together, pods (HPA/KEDA) and nodes (Karpenter/Cluster Autoscaler). How they fit, where each shines, and how to avoid thrash.

Autoscaling Done Right: HPA, KEDA, and Karpenter
"Just turn on autoscaling" hides the fact that Kubernetes scales at two different layers that have
to cooperate: scaling pods (more replicas of your app) and scaling nodes (more machines to put
pods on). Get the relationship between them right and your cluster absorbs load smoothly and shrinks
when it's quiet. Get it wrong and you get pods stuck Pending, nodes thrashing up and down, or a bill
that never comes back down.
The two layers
- Pod autoscaling: add/remove replicas of a workload. Tools: HPA (Horizontal Pod Autoscaler) and KEDA.
- Node autoscaling: add/remove nodes so pods have somewhere to run. Tools: Cluster Autoscaler and Karpenter.
They work as a chain: load rises → pod autoscaler wants more replicas → some go Pending (no room) →
node autoscaler adds capacity → pods schedule. When load falls, it unwinds in reverse. If only one
layer is configured, you stall.
HPA: the baseline for pods
The Horizontal Pod Autoscaler scales replicas based on metrics, classically CPU/memory:
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
spec:
scaleTargetRef: { apiVersion: apps/v1, kind: Deployment, name: api }
minReplicas: 2
maxReplicas: 20
metrics:
- type: Resource
resource:
name: cpu
target: { type: Utilization, averageUtilization: 60 }
Solid for CPU/memory-bound services. Its limit: it's awkward at scaling on anything else, and lots of workloads aren't CPU-bound. A queue worker's real signal is queue depth, not CPU.
KEDA: event-driven pod scaling
KEDA extends HPA to scale on external signals: and crucially, scale to zero. It has scalers for SQS queue length, Kafka lag, Prometheus queries, cron schedules, and dozens more.
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
spec:
scaleTargetRef: { name: worker }
minReplicaCount: 0 # scale to zero when idle
maxReplicaCount: 50
triggers:
- type: aws-sqs-queue
metadata:
queueURL: https://sqs.../jobs
queueLength: "5" # ~5 messages per replica
This is the right tool for queue/event workers: zero pods (and cost) when the queue is empty, scale out with backlog, scale back down after. For anything driven by a queue, stream, or schedule, reach for KEDA over raw HPA.
Karpenter: smarter node scaling
The Cluster Autoscaler adds nodes from predefined node groups. Karpenter (AWS-born, now broader) is more flexible and faster, it provisions right-sized nodes on demand based on what the pending pods actually need, picks instance types/sizes for you, and consolidates underused nodes.
Why it matters for cost and speed:
- Right-sizing: instead of "scale up another m5.xlarge," it picks the cheapest instance that fits the pending pods, mixing types.
- Consolidation: actively bin-packs and removes underused nodes, so you don't drift into paying for half-empty machines.
- Spot-native: easy to run a mix of spot and on-demand with graceful handling, big savings on fault-tolerant work.
If you're on EKS, Karpenter is usually the better choice over Cluster Autoscaler today.
Making the layers cooperate (avoiding thrash)
The common failure is flapping: scaling up and down repeatedly, which is wasteful and destabilizing:
- Tune stabilization windows. HPA's scale-down stabilization prevents yanking replicas the instant load dips. Scale up fast, scale down slow.
- Set resource requests accurately. Both pod and node autoscalers reason about requests. Wrong requests = wrong scaling decisions and poor bin-packing.
- Use PodDisruptionBudgets so node consolidation/scale-down doesn't take down too many replicas of a service at once.
- Give scale-up headroom if cold starts hurt: a little over-provision (or pause-pod "overprovisioning") means capacity is ready before the stampede.
- Mind metric lag. Scaling reacts to metrics that are seconds-to-minutes old; for sharp spikes, predictive or schedule-based (KEDA cron) scaling beats purely reactive.
A sensible default stack
For most production EKS clusters:
- KEDA for pods: CPU/memory for web services, queue/stream/cron triggers for workers (with scale-to-zero where it fits).
- Karpenter for nodes: right-sized, consolidating, spot-aware.
- Accurate requests, PDBs, and tuned stabilization to keep it smooth.
That combination scales smoothly under load and genuinely shrinks (and saves money) when traffic drops. Pair it with cost dashboards so you can see the savings.
The short version
- Kubernetes scales at two layers, pods (HPA/KEDA) and nodes (Karpenter/Cluster Autoscaler), and they must cooperate.
- HPA for CPU/memory; KEDA for event-driven and scale-to-zero workers.
- Karpenter for right-sized, consolidating, spot-aware node scaling.
- Avoid thrash: accurate requests, scale-up-fast/down-slow, PDBs, and headroom for cold starts.
Right-sizing and autoscaling Kubernetes for performance and cost is part of my consulting work, reach out.