What is KEDA?
KEDA (Kubernetes Event-Driven Autoscaling) is a tool that lets your Kubernetes apps automatically add or remove pods based on real-time events, like messages in a queue. It works alongside the normal Kubernetes autoscaler but focuses on event-driven workloads.
Let's break it down
- Kubernetes: a system that runs many small containers (pods) across many computers.
- Autoscaling: automatically changing the number of pods so the app can handle more or less traffic.
- Event-Driven: instead of looking at CPU or memory, it watches things that happen (e.g., a new message, a file upload).
- KEDA: a piece of software that connects those events to the autoscaling logic, telling Kubernetes when to grow or shrink.
Why does it matter?
Because many modern apps react to spikes in external events (like a burst of orders or sensor data). KEDA lets you scale exactly when you need to, saving money and keeping performance smooth without manual tuning.
Where is it used?
- Message-queue processing: scaling workers up when a RabbitMQ or Azure Service Bus queue fills up, then scaling down when it’s empty.
- Serverless functions on Kubernetes: running lightweight functions that fire on HTTP requests, Kafka topics, or database changes.
- IoT data ingestion: adding pods to handle a sudden flood of sensor readings, then shrinking back after the burst passes.
- Batch job orchestration: launching more pods to process a large batch of files stored in cloud storage, then releasing them when done.
Good things about it
- Works with any Kubernetes cluster, no need for a special cloud provider.
- Supports dozens of event sources (queues, streams, databases, HTTP, etc.).
- Combines with the built-in Horizontal Pod Autoscaler, so you can use both metrics together.
- Simple to install via a Helm chart or operator.
- Reduces cost by scaling to zero when there are no events.
Not-so-good things
- Adds another layer of configuration; mis-setting thresholds can cause rapid scaling “flaps.”
- Relies on external event sources being reachable; network issues can delay scaling decisions.
- Limited to scaling at the pod level; it doesn’t manage other resources like CPU limits automatically.
- Some enterprise features (e.g., advanced metrics) may require extra plugins or custom code.