我试图在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
字符串
1条答案
按热度按时间yjghlzjz1#
解决方案是在规范中设置
hostNetwork: true
以进行部署。参考:https://github.com/GoogleCloudPlatform/k8s-stackdriver/issues/315