Event-driven Autoscaling with KEDA
KEDA (Kubernetes Event-driven Autoscaling) is a Kubernetes component that allows you to scale pods based on external event sources like Kafka, RabbitMQ, AWS SQS, Prometheus metrics, etc.
Key Concepts:
- Scalers: Define the event source (e.g., queue length)
- ScaledObject: Maps the deployment and scaler
Example ScaledObject:
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: queue-scaler
spec:
scaleTargetRef:
name: worker
triggers:
- type: rabbitmq
metadata:
queueName: jobs
host: RabbitMQConnection
Install KEDA:
kubectl apply -f https://github.com/kedacore/keda/releases/latest/download/keda-operator.yaml