---

title: Kubernetes HPA External Metrics 与 Prometheus Adapter 实战

keywords: HPA, external metrics, Prometheus Adapter, averageValue, autoscaling/v2

description: 使用 HPA 基于 Prometheus Adapter 的外部指标进行自动扩缩,配置目标值与副本范围,平滑应对流量波动。

categories:

  • 文章资讯
  • 技术教程

---

HorizontalPodAutoscaler:

apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: api-hpa
  namespace: default
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: api
  minReplicas: 2
  maxReplicas: 30
  metrics:
  - type: External
    external:
      metric:
        name: http_requests_per_second
        selector:
          matchLabels:
            service: api
      target:
        type: AverageValue
        averageValue: 100

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论
立即
投稿

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部