小编Tim*_*Tim的帖子

如何根据另一个部署产生的指标使HPA扩展一个部署

我要实现的目标是创建一个能够worker根据Pod 生成的自定义指标缩放Pod的Horizo​​ntal Pod Autoscaler controller

我已经使Prometheus抓取,Prometheus Adapater,Custom Metric Server完全运行,并且已经worker使用了my_controller_metricworkerpod 生成的自定义指标来扩展部署。

现在,我的广告worker连播不再产生此指标,但实际产生了controller。似乎API autoscaling / v1不支持此功能。如果需要,我可以使用autoscaling / v2beta1 API指定HPA。

这是我对此HPA的规格:

apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
  name: my-worker-hpa
  namespace: work
spec:
  maxReplicas: 10
  minReplicas: 1
  scaleTargetRef:
    apiVersion: extensions/v1beta1
    kind: Deployment
    name: my-worker-deployment
  metrics:
  - type: Object
    object:
      target:
        kind: Deployment
        name: my-controller-deployment
      metricName: my_controller_metric
      targetValue: 1
Run Code Online (Sandbox Code Playgroud)

当应用配置时,kubectl apply -f my-worker-hpa.yml我收到消息:

horizontalpodautoscaler "my-worker-hpa" configured
Run Code Online (Sandbox Code Playgroud)

尽管此消息似乎还可以,但是HPA无法正常工作。这个规格格式不正确吗?

就像我说的那样,该指标可在Custom Metric Server中使用kubectl …

horizontal-scaling kubernetes

5
推荐指数
1
解决办法
254
查看次数

标签 统计

horizontal-scaling ×1

kubernetes ×1