Scale to Zero, Wake on Queue — KEDA in K8s
Stop paying for idle pods
If you've got worker services sitting idle 90% of the time, you're burning cluster capacity for nothing. KEDA lets those deployments scale all the way down to zero — then wake up the instant work shows up at the door.
What KEDA actually does
KEDA (Kubernetes Event-Driven Autoscaling) is a lightweight operator that extends the Horizontal Pod Autoscaler beyond CPU and memory. Instead of guessing resource thresholds, you scale on things that reflect real demand: how many messages are sitting in your Kafka topic, how deep your RabbitMQ queue is, how many rows match a PostgreSQL query.
The killer feature is scale-to-zero. Standard HPA bottoms out at one replica — always running, always costing. KEDA takes you to zero replicas when the event source goes quiet, then spins pods back up the moment new work arrives. No cron job babysitting, no cold-start hacks.
It supports 60+ triggers out of the box
Kafka, AWS SQS, Redis lists, Azure Service Bus, PostgreSQL, gRPC streams, Prometheus queries, even cron schedules. You define a ScaledObject and KEDA handles the watching, the metrics, and the scaling decisions.
The config
Here's a worker that sleeps until Kafka messages pile up, then scales between 1 and 10 pods based on consumer lag:
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: order-worker
namespace: default
spec:
scaleTargetRef:
name: order-worker
minReplicaCount: 0
maxReplicaCount: 10
pollingInterval: 30
triggers:
- type: kafka
metadata:
bootstrapServers: kafka-broker:9092
topic: orders
consumerGroup: order-workers
lagThreshold: "100"Zero messages, zero pods. Messages land, KEDA spins up replicas proportional to lag. Queue drains, pods scale back to zero. Fully hands-off.
Install it
helm install keda keda/keda --namespace keda --create-namespaceTL;DR
- KEDA adds event-driven autoscaling to Kubernetes, including true scale-to-zero
- 60+ built-in triggers: Kafka, SQS, Redis, Postgres, cron, Prometheus, and more
- One Helm install, one ScaledObject YAML, and your idle pods are history