我在 Google Kubernetes Engine 上有以下 Horizontal Pod Autoscaler 配置,可以通过自定义指标扩展部署 -RabbitMQ messages ready count
针对特定队列:foo-queue
.
它正确地获取度量值。
插入 2 条消息时,它会将部署扩展到最多 10 个副本。我希望它可以扩展到 2 个副本,因为 targetValue 是 1 并且有 2 条消息准备好了。
为什么它会如此积极地扩展?
HPA 配置:
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: foo-hpa
namespace: development
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: foo
minReplicas: 1
maxReplicas: 10
metrics:
- type: External
external:
metricName: "custom.googleapis.com|rabbitmq_queue_messages_ready"
metricSelector:
matchLabels:
metric.labels.queue: foo-queue
targetValue: 1