37 lines
1.4 KiB
Markdown
37 lines
1.4 KiB
Markdown
---
|
||
title: "KEDA (Kubernetes Event-Driven Autoscaling)"
|
||
type: concept
|
||
tags:
|
||
- Kubernetes
|
||
- EKS
|
||
- Autoscaling
|
||
- Event-Driven
|
||
- Serverless
|
||
sources:
|
||
- ctp-topic-64-scaling-out-with-amazon-eks
|
||
last_updated: 2026-04-28
|
||
---
|
||
|
||
## Definition
|
||
KEDA(Kubernetes Event-Driven Autoscaling)是一个基于外部事件驱动的 Kubernetes 扩缩容框架,通过 ScaledObject 自定义资源定义(CRD)实现细粒度的事件驱动扩缩容,支持将应用从零副本扩展到任意规模。
|
||
|
||
## Key Mechanisms
|
||
- **ScaledObject CRD**:定义扩缩规则,指定 Scaler 和目标副本数范围
|
||
- **事件源(Scalers)**:支持 50+ 种事件源(Kafka、RabbitMQ、AWS SQS、Azure Queue、HTTP 等)
|
||
- **零扩展(Scale to Zero)**:支持将应用缩容至零副本,降低空闲资源成本
|
||
- **Publishes Metrics 模式**:可向 HPA 发布指标,实现事件驱动与指标驱动的混合扩缩容
|
||
- **声明式配置**:通过 YAML 配置文件定义扩缩行为,与 GitOps 工作流兼容
|
||
|
||
## Relationship with HPA
|
||
- KEDA 可独立工作,也可作为 HPA 的指标提供者
|
||
- 组合模式:KEDA 监听外部事件 → 发布指标 → HPA 基于指标调整副本数
|
||
|
||
## Use Cases
|
||
- 事件驱动微服务(消息队列消费者)
|
||
- 批处理作业(按需触发)
|
||
- 突发流量场景(限时促销、实时事件)
|
||
- 无服务器化改造(零扩展降低成本)
|
||
|
||
## Sources
|
||
- [[ctp-topic-64-scaling-out-with-amazon-eks]]
|