ScriptsApr 15, 2026·3 min read

KEDA — Kubernetes Event-Driven Autoscaling

CNCF-graduated autoscaler that scales Kubernetes workloads to and from zero using 70+ event sources like Kafka, SQS, Prometheus and Redis.

TL;DR
KEDA adds event-driven autoscaling to Kubernetes, scaling pods to zero and back using 70+ triggers.
§01

What it is

KEDA (Kubernetes Event-Driven Autoscaling) is a CNCF-graduated project that extends the native Kubernetes Horizontal Pod Autoscaler (HPA) with event-driven triggers. Instead of scaling only on CPU or memory, KEDA lets you scale workloads based on queue depth, stream lag, cron schedules, database row counts, or metrics from 70+ sources.

KEDA is built for platform engineers, DevOps teams, and backend developers who run event-driven microservices on Kubernetes. If your workloads are bursty or idle most of the time, KEDA can scale them to zero when there is no work and spin them up within seconds when events arrive.

§02

How it saves time or tokens

KEDA eliminates the need to write custom autoscaling controllers. Without KEDA, scaling a Kafka consumer based on consumer group lag requires a custom metrics adapter, a Prometheus query, and an HPA configuration. KEDA wraps all of that into a single ScaledObject YAML manifest. The result is fewer moving parts, less custom code to maintain, and faster iteration on scaling policies.

For cost optimization, KEDA's scale-to-zero capability means idle workloads consume no compute resources. In a multi-tenant cluster running dozens of event consumers, this can reduce node count significantly during off-peak hours.

§03

How to use

  1. Install KEDA via Helm into your cluster:
helm repo add kedacore https://kedacore.github.io/charts
helm upgrade --install keda kedacore/keda -n keda --create-namespace
  1. Define a ScaledObject that targets your Deployment and specifies triggers:
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: kafka-scaler
spec:
  scaleTargetRef:
    name: consumer
  minReplicaCount: 0
  maxReplicaCount: 50
  triggers:
  - type: kafka
    metadata:
      bootstrapServers: kafka:9092
      consumerGroup: my-group
      topic: orders
      lagThreshold: '10'
  1. Apply the manifest and KEDA handles the rest -- it creates an HPA under the hood, polls the trigger source, and adjusts replica count accordingly.
§04

Example

Scale an AWS SQS consumer to zero when the queue is empty:

apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: sqs-scaler
spec:
  scaleTargetRef:
    name: sqs-worker
  minReplicaCount: 0
  maxReplicaCount: 20
  triggers:
  - type: aws-sqs-queue
    metadata:
      queueURL: https://sqs.us-east-1.amazonaws.com/123456/orders
      queueLength: '5'
    authenticationRef:
      name: aws-credentials

When queueLength exceeds 5 messages per pod, KEDA adds replicas. When the queue drains, pods scale to zero.

§05

Related on TokRepo

§06

Common pitfalls

  • Setting minReplicaCount: 0 means cold starts. If your workload cannot tolerate startup latency, set the minimum to 1.
  • KEDA polls trigger sources at a configurable interval (default 30s). For sub-second scaling, you need to tune pollingInterval and accept higher API call volume.
  • Mixing KEDA ScaledObjects with manually created HPAs on the same Deployment causes conflicts. Let KEDA own the HPA entirely.

Frequently Asked Questions

What Kubernetes versions does KEDA support?+

KEDA supports Kubernetes 1.24 and above. Each KEDA release documents a compatibility matrix in its GitHub repository. Older clusters may work but are not officially tested.

Can KEDA scale Jobs instead of Deployments?+

Yes. KEDA provides a ScaledJob resource that creates Kubernetes Jobs in response to events. This is useful for batch processing where each event should spawn an independent, run-to-completion Job rather than a long-running pod.

How does KEDA differ from the built-in HPA?+

The native HPA only scales on CPU, memory, or custom metrics you expose via a metrics adapter. KEDA adds 70+ built-in trigger types and supports scaling to zero, which the native HPA cannot do.

Does KEDA work with serverless frameworks like Knative?+

KEDA and Knative solve overlapping problems but are independent projects. KEDA focuses on scaling Deployments and Jobs, while Knative provides a broader serverless platform. Some teams use KEDA for worker scaling and Knative for HTTP-serving workloads.

Is KEDA production-ready?+

KEDA is a CNCF-graduated project, which is the highest maturity level in the Cloud Native Computing Foundation. It is used in production by organizations running large Kubernetes clusters.

Citations (3)

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets