Skip to content

KEDA Isn’t the Autoscaler: Understanding the Four Control Loops Behind Kubernetes Scaling

Most engineers describe KEDA as the thing that scales Kubernetes pods based on Kafka or RabbitMQ. That’s only a small part of the story. KEDA doesn’t scale your application. It participates in a chain of independent control loops, each responsible for one piece of the scaling process.

Published
Reading time
6 min
Topics
kubernetes, devops, autoscaling
Cover illustration for "KEDA Isn’t the Autoscaler: Understanding the Four Control Loops Behind Kubernetes Scaling"

Most engineers describe KEDA as “the thing that scales Kubernetes pods based on Kafka or RabbitMQ.”

That’s true, but it’s only a small part of the story.

The first time I deployed KEDA in production, I assumed it would magically spin up more workers whenever a queue grew. Instead, I watched hundreds of Pods stuck in the Pending state while my Kafka lag kept increasing.

KEDA wasn’t broken.

Kubernetes wasn’t broken.

The cluster was doing exactly what it was designed to do.

The real lesson was this:

KEDA doesn’t scale your application. It participates in a chain of independent control loops, each responsible for one piece of the scaling process.

Once you understand those control loops, Kubernetes autoscaling stops feeling like magic and starts making perfect sense.

Autoscaling Is Not One System

Imagine an image-processing platform.

Every uploaded image becomes a Kafka message.

Workers consume messages, resize images, generate thumbnails, and store the results.

Everything works fine until someone uploads a million images at once.

Your instinct might be:

“KEDA should create more Pods.”

But that’s not actually what happens.

Instead, four completely independent systems wake up , one after another.

Each component solves one problem.

Nothing more.

Control Loop #1: KEDA Understands the Workload

KEDA’s only job is to answer a simple question:

How much work is waiting?

Unlike the traditional Horizontal Pod Autoscaler, KEDA doesn’t care about CPU utilization.

It watches external systems such as:

  • Kafka consumer lag
  • RabbitMQ queue depth
  • AWS SQS messages
  • Redis Streams
  • Azure Service Bus
  • Prometheus metrics
  • PostgreSQL queries
  • HTTP request volume

Suppose Kafka reports:

Consumer Lag
1,000,000 Messages

KEDA calculates:

Desired Workers = 250

That’s it.

It doesn’t create Pods.

It doesn’t schedule anything.

It simply converts an external event into a desired replica count.

Think of KEDA as a translator between your event source and Kubernetes.

Control Loop #2: The Horizontal Pod Autoscaler (HPA)

Once KEDA calculates the desired replica count, it updates the Kubernetes Horizontal Pod Autoscaler.

The HPA now compares two numbers:

Current Replicas = 20
Desired Replicas = 250

It updates the Deployment.

Kubernetes immediately tries to create 230 additional Pods.

Notice that HPA still isn’t responsible for finding somewhere to run them.

It only changes the desired state of the Deployment.

Control Loop #3: The Kubernetes Scheduler

The Scheduler now begins examining every new Pod.

Each Pod might request:

CPU: 2 vCPU
Memory: 4 GB

The Scheduler searches every node in the cluster.

Node A
95% Full
No room
-------------------
Node B
100% Full
No room
-------------------
Node C
92% Full
No room

Eventually every remaining Pod becomes:

Pending

This often surprises engineers.

Pods existing in Kubernetes doesn’t mean there’s actually hardware available to run them.

The Scheduler cannot create infrastructure.

It only decides where Pods should run.

Control Loop #4: Cluster Autoscaler

Now another controller notices something interesting.

Hundreds of Pods are pending.

Why?

Insufficient CPU
Insufficient Memory

Cluster Autoscaler asks the cloud provider for additional virtual machines.

For example:

Launch
10 EC2 Instances

A few minutes later:

New Nodes Join Cluster

The Scheduler retries.

Pending Pods finally receive compute resources.

Only then do your workers actually start processing messages.

A Complete Scaling Timeline

Understanding the timing explains why autoscaling sometimes feels “slow.”

12:00:00
1 Million Kafka Messages Arrive
↓
12:00:10
KEDA Detects Queue Growth
↓
12:00:15
HPA Updates Deployment
20 → 250 Replicas
↓
12:00:16
↓
Scheduler Places 40 Pods
210 Pods Become Pending
↓
12:00:20
Cluster Autoscaler Requests More Nodes
↓
12:03:00
Cloud Provider Launches Instances
↓
12:04:30
Nodes Join Cluster
↓
12:05:00
Remaining Pods Start Running
↓
Workers Begin Consuming Messages

This entire chain is why scaling large Kubernetes workloads can take several minutes, even when KEDA reacts within seconds.

Kubernetes Is Really a Collection of Feedback Loops

The interesting part is that none of these systems directly communicate with one another.

Instead, every controller repeatedly follows the same pattern:

Observe
↓
Compare
↓
Act
↓
Repeat

This is classic control theory.

It’s the same principle used by:

  • Thermostats
  • Cruise control
  • Aircraft autopilots
  • Industrial automation systems

Each controller continuously compares the desired state with the actual state and makes small adjustments.

Kubernetes isn’t a single intelligent system.

It’s dozens of specialized feedback loops cooperating toward a common goal.

The Hidden Cost of Reactive Scaling

One misconception about autoscaling is that scaling happens instantly.

In reality, every stage introduces latency.

Imagine:

  • KEDA polling interval: 30 seconds
  • Cluster Autoscaler provisioning: 3 minutes
  • Container startup: 45 seconds
  • Application warm-up: 15 seconds

Total reaction time:

30s
+
180s
+
45s
+
15s
=
270 seconds

That’s four and a half minutes before the first additional worker begins processing requests.

If your workload grows faster than your infrastructure can react, autoscaling will always be behind demand.

This is one reason why many production platforms deliberately maintain spare capacity.

Why Scale-to-Zero Isn’t Always a Good Idea

Scale-to-zero is one of KEDA’s most attractive features.

No traffic?

Run zero Pods.

Pay almost nothing.

Unfortunately, reality is more complicated.

Consider an AI inference service.

A request arrives while no workers exist.

Now Kubernetes must:

  • Provision a GPU node
  • Install GPU drivers
  • Pull a multi-gigabyte container image
  • Start Python
  • Load model weights
  • Build CUDA kernels
  • Warm caches

Depending on the workload, startup can easily take several minutes.

Your first customer experiences all of it.

This is why many AI companies intentionally keep one warm replica alive despite the additional cost.

The infrastructure is more expensive.

The user experience is dramatically better.

Queue Length Isn’t Always the Right Metric

Another common assumption is:

More messages equals more workers.

That only works when every job costs roughly the same.

Imagine a video processing service.

Job A
3 Seconds
--------------
Job B
2 Hours
--------------
Job C
10 Seconds
--------------
Job D
45 Minutes

A queue containing 100 jobs could represent five minutes of work — or several days.

Large platforms often combine multiple signals instead of relying solely on queue depth.

For example:

  • Consumer lag
  • Oldest message age
  • Processing throughput
  • Average execution time
  • SLA deadlines
  • Customer priority
  • Historical traffic patterns
  • Infrastructure cost

Autoscaling becomes much more accurate when decisions are based on overall system health rather than a single metric.

Reactive Scaling Is Becoming Predictive

The next generation of Kubernetes autoscaling isn’t waiting for traffic.

It’s trying to predict it.

Instead of reacting after queues begin growing, predictive systems analyze historical usage patterns.

Traffic Prediction
↓
Provision Nodes
↓
Warm Containers
↓
Load Models
↓
Requests Arrive

By the time users generate traffic, the infrastructure is already running.

This significantly reduces cold-start latency and avoids the delays inherent in reactive control loops.

It’s an increasingly common approach for AI platforms, large SaaS applications, and globally distributed systems.

Key Takeaways

KEDA is an excellent technology, but understanding where its responsibility ends is far more important than memorizing its features.

KEDA never creates Pods.

The Horizontal Pod Autoscaler never provisions infrastructure.

The Scheduler never launches virtual machines.

Cluster Autoscaler never reads Kafka.

Each controller solves exactly one problem, and together they create Kubernetes’ distributed feedback system.

Once you understand these control loops, production scaling becomes much easier to reason about.

Instead of asking:

“Why didn’t KEDA scale my application?”

You’ll start asking better questions:

  • Was KEDA receiving the correct metrics?
  • Did HPA request enough replicas?
  • Were Pods schedulable?
  • Did the cluster have enough capacity?
  • Was node provisioning fast enough?
  • Were cold starts the real bottleneck?

Those are the questions platform engineers at companies like Google, Netflix, Uber, and OpenAI spend far more time answering than simply tweaking replica counts.

Reactions

Comments

Leave a comment