---

title: KEDA 基于 Prometheus 指标自动伸缩实践

keywords: KEDA, ScaledObject, prometheus trigger, threshold, pollingInterval, cooldownPeriod

description: 使用 KEDA 根据 Prometheus 指标自动伸缩 Deployment,配置触发器与轮询/冷却参数以平滑扩缩容。

categories:

  • 文章资讯
  • 技术教程

---

ScaledObject(基于 Prometheus 指标):

apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: api-scaled
  namespace: default
spec:
  scaleTargetRef:
    name: api
  minReplicaCount: 2
  maxReplicaCount: 20
  pollingInterval: 30
  cooldownPeriod: 300
  triggers:
  - type: prometheus
    metadata:
      serverAddress: http://prometheus-operated.default.svc.cluster.local
      metricName: http_requests_per_second
      query: sum(rate(http_requests_total{service="api"}[2m]))
      threshold: "100"

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论
立即
投稿

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部