我要实现的目标是创建一个能够worker
根据Pod 生成的自定义指标缩放Pod的Horizontal Pod Autoscaler controller
。
我已经使Prometheus抓取,Prometheus Adapater,Custom Metric Server完全运行,并且已经worker
使用了my_controller_metric
由worker
pod 生成的自定义指标来扩展部署。
现在,我的广告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 …