我正在尝试基于GKE中的外部指标使用HPA,但它给出了错误-
horizontal-pod-autoscaler unable to get external metric default/custom.googleapis.com|rabbitmq_queue_messages_ready/nil: unable to fetch metrics from external metrics API: the server is currently unable to handle the request (get custom.googleapis.com|rabbitmq_queue_messages_ready.external.metrics.k8s.io
我在k8集群中设置了一个外部指标,该指标将数据发送到Google Stackdriver。该度量标准包含有关rabbitmq中消息数量的信息,该队列不在集群内。基于队列长度,我正在尝试自动缩放我的pod。 现在,我可以将数据推送到stackdriver并可以在Metric Explorer中查看指标。但是,当我尝试在我的HPA中使用它时,会出现错误。
HPA-
apiVersion: autoscaling/v2beta1
kind: HorizontalpodAutoscaler
metadata:
name: exp-anno-hpa
spec:
scaletargetRef:
apiVersion: apps/v1beta1
kind: Deployment
name: exp-anno
minreplicas: 2
maxReplicas: 6
metrics:
- type: External
external:
metricName: "custom.googleapis.com|rabbitmq_queue_messages_ready"
targetvalue: 10