System Atlas
the atlas

Kubernetes scaling strategies

Five levers for meeting demand — from a hand-set replica count to event-driven autoscaling.

the gist

Kubernetes can scale in several complementary ways: set a replica count manually, add pods automatically with the Horizontal Pod Autoscaler, right-size pods with the Vertical Pod Autoscaler, add nodes with the Cluster Autoscaler, and scale on external events (like queue depth) with KEDA. Horizontal scaling adds copies, vertical scaling adds power, cluster scaling adds machines — and they're usually combined.

ANALOGY // Running a call center: HPA staffs more agents as calls rise, VPA gives each agent a faster computer, the Cluster Autoscaler leases more office floors when you run out of desks, and KEDA hires based on how many callers are waiting in the queue.
living diagram01 / 05
Five scaling levers, from the simplest to the most dynamic.
01
Manual replicas
kubectl scale · fixed count
02
Horizontal Pod Autoscaler
more pods · CPU / custom metrics
03
Vertical Pod Autoscaler
bigger pods · right-size requests
04
Cluster Autoscaler
more nodes · add / remove machines
05
KEDA (event-driven)
scale on events · down to zero
01

Manual replicas

The simplest lever is to set the replica count yourself — kubectl scale deployment web --replicas=5, or a fixed number in the Deployment spec. Kubernetes keeps exactly that many pods running, replacing any that die. It's predictable and perfect for steady, well-understood workloads, but it can't react to traffic on its own, so you either over-provision for the peak or get caught short during a spike.

02

Horizontal Pod Autoscaler

The HPA automatically adjusts the number of pod replicas based on observed metrics — most commonly average CPU utilization, but also memory or custom and external metrics. When load rises above the target, it adds pods; when it falls, it removes them. This is the workhorse of Kubernetes autoscaling because most stateless services scale out cleanly by simply running more identical copies.

03

Vertical Pod Autoscaler

Instead of more pods, the VPA makes each pod the right size. It observes actual CPU and memory usage over time and adjusts the pod's resource requests and limits so it isn't starved or wastefully over-allocated. It's ideal for workloads that don't parallelize well — a single stateful process — but because applying a change usually restarts the pod, VPA and HPA on the same metric don't mix well.

04

Cluster Autoscaler

Adding pods only helps if there's somewhere to put them. The Cluster Autoscaler watches for pods that are stuck Pending because no node has room and provisions new nodes from the cloud provider to fit them. When nodes later sit underused, it drains and removes them to save money. It scales the cluster's machine count, working hand-in-glove with the HPA, which scales the pod count.

05

KEDA and event-driven scaling

CPU isn't always the right signal — a queue consumer should scale on how many messages are waiting, not how busy it currently is. KEDA (Kubernetes Event-Driven Autoscaling) drives scaling from external sources like Kafka lag, RabbitMQ depth, or cloud queue length, and uniquely can scale all the way to zero when there's no work and back up when events arrive. It's the go-to for bursty, event-driven, and batch workloads.

the full picture
01

Why scaling needs a strategy

The whole point of running on Kubernetes is that capacity shouldn't be a manual, all-nighter affair. Traffic rises and falls — daily peaks, marketing spikes, batch jobs, seasonal surges — and you want the cluster to meet demand without over-provisioning (paying for idle machines) or under-provisioning (dropping requests). Kubernetes doesn't give you one scaling button; it gives you several distinct levers that operate at different layers, and using them well means knowing which lever fits which problem.

The foundational distinction is horizontal vs vertical. Scaling *horizontally* means running more copies of a workload; scaling *vertically* means giving each copy more power. Kubernetes offers autoscalers for both, plus a third autoscaler for the underlying machines and event-driven options on top. They are complementary, and real clusters usually run several at once.

02

Manual replicas: the baseline

The simplest way to scale is to state the number of replicas yourself. A Deployment declares replicas: 3, or you run kubectl scale deployment web --replicas=5, and the Deployment controller ensures exactly that many pods exist — creating replacements whenever a pod dies. This is horizontal scaling done by hand.

Its virtue is predictability: you know precisely how much capacity is running and what it costs, which is ideal for steady workloads or when you want tight control. Its weakness is that it's static — a fixed count can't respond to a traffic spike or quiet down overnight. To stay safe you end up sizing for the peak and paying for that headroom around the clock. That trade-off is exactly what the autoscalers exist to remove.

03

HPA and VPA: scaling pods out and up

The Horizontal Pod Autoscaler (HPA) automates the replica count. You give it a target — say, keep average CPU at 60% — and it watches the metric and adjusts the number of pods to hit it, adding replicas under load and removing them when things calm down. Beyond CPU and memory it can scale on custom metrics (requests per second) or external metrics, making it the default autoscaler for stateless services that scale cleanly by simply running more identical copies.

The Vertical Pod Autoscaler (VPA) takes the other axis. Instead of changing how *many* pods run, it changes how *big* each one is, tuning a pod's CPU and memory requests to match what it actually uses — bumping up a starved pod, trimming a wasteful one. It shines for workloads that can't be parallelized, like a single stateful process, and for taking the guesswork out of setting resource requests. The important caveat: applying a new size generally means restarting the pod, and running VPA and HPA against the *same* metric conflicts, since one wants to resize while the other wants to add copies. Teams typically use HPA for scaling out and VPA for right-sizing, on different signals.

04

Cluster Autoscaler and KEDA: nodes and events

Pod autoscalers assume there's room to place new pods, but eventually there isn't. The Cluster Autoscaler scales the *infrastructure* itself: when pods are stuck Pending because no node can fit them, it asks the cloud provider for more nodes; when nodes sit underused, it drains and removes them to cut cost. It pairs naturally with the HPA — the HPA creates more pods, and the Cluster Autoscaler creates the machines to hold them. (Newer projects like Karpenter do the same job with faster, more flexible node provisioning.)

KEDA (Kubernetes Event-Driven Autoscaling) adds a fundamentally different trigger. Plain HPA reacts to resource *utilization*, but many workloads should scale on an external event signal instead — the number of messages waiting in a Kafka topic or RabbitMQ queue, the length of a cloud queue, rows in a database, or a cron schedule. KEDA feeds those signals into scaling decisions and, uniquely, can scale to zero: with no work pending it runs *no* pods at all, then spins them up the instant events arrive. That makes it ideal for bursty, event-driven, and batch workloads where paying for idle replicas makes no sense.

05

Combining the levers in practice

These strategies are not alternatives to choose between — they compose into a scaling stack, each covering a layer the others can't. A common production setup looks like this: an HPA scales a stateless web service out and in on CPU or request rate; the Cluster Autoscaler (or Karpenter) adds and removes nodes underneath so the HPA always has somewhere to place pods; VPA (in recommendation mode, or on separate workloads) keeps resource requests honest so scheduling decisions are accurate; and KEDA drives the event-consuming and batch workloads from queue depth, scaling them to zero when idle. Manual replica counts still make sense for a few steady, critical services where you want no surprises.

The guiding principles are worth internalizing. Prefer horizontal scaling for anything stateless — more small copies are cheaper and more resilient than one giant pod. Use vertical scaling to right-size, not to chase load. Remember that pod autoscaling is useless without node autoscaling behind it. And match the *signal* to the workload: CPU for compute-bound services, queue depth for consumers. Set sane minimums and maximums on every autoscaler so a metric glitch can't scale you to zero or bankrupt you, and the result is a cluster that quietly tracks demand up and down without anyone touching it.

what to remember
01

Manual replicas: set a fixed pod count with kubectl scale or the Deployment spec — simple and predictable.

02

Horizontal Pod Autoscaler (HPA): adds/removes pod replicas based on CPU, memory, or custom metrics.

03

Vertical Pod Autoscaler (VPA): adjusts each pod's CPU/memory requests to right-size it.

04

Cluster Autoscaler: adds or removes whole nodes when pods can't be scheduled or nodes sit idle.

05

KEDA: event-driven autoscaling on external signals like queue length — and can scale to zero.

06

The layers combine: HPA adds pods, the Cluster Autoscaler adds nodes to hold them.

check yourself

Quick quiz

Q1

What does the Horizontal Pod Autoscaler change?

Q2

Your HPA wants more pods but they're stuck Pending. What's missing?

follow the thread