Autoscaling 基于Kubernetes HPA的数据狗度量

Autoscaling 基于Kubernetes HPA的数据狗度量,autoscaling,datadog,hpa,Autoscaling,Datadog,Hpa,我在最后几天阅读并使用基于HPA的Datadog指标。 我把文件放在下面 这是我的数据量表 apiVersion: datadoghq.com/v1alpha1 kind: DatadogMetric metadata: name: deliver-rate namespace: beta spec: query: rabbitmq.queue.messages.deliver.rate{environment:production,rabbitmq_queue:enqueue.

我在最后几天阅读并使用基于HPA的Datadog指标。 我把文件放在下面

这是我的数据量表

apiVersion: datadoghq.com/v1alpha1
kind: DatadogMetric
metadata:
  name: deliver-rate
  namespace: beta
spec:
  query: rabbitmq.queue.messages.deliver.rate{environment:production,rabbitmq_queue:enqueue.xxx.callable}.as_count()

这是我的HPA

apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
  name: test-beta2
  namespace: beta
spec:
  minReplicas: 1
  maxReplicas: 8
  behavior:
    scaleDown:
      stabilizationWindowSeconds: 10
      policies:
      - type: Pods
        value: 2
        periodSeconds: 2
    scaleUp:
      stabilizationWindowSeconds: 10
      policies:
      - type: Pods
        value: 2
        periodSeconds: 2
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: dealroom-xxx
  metrics:
    - type: External
      external:
        metric:
          name: 'datadogmetric@beta:deliver-rate'
        target:
          type: Value
          value: 200
我有两个问题

一,

当度量值高于定义的目标值时,所有这些都起作用,但没有以正确的方式放大。例如,在下面,我将放置
metricvalue/targetvalue
和相应的
desiredReplicas

desiredReplicas: 4   252/200
desiredReplicas: 6   252/200
desiredReplicas: 6   252/200
desiredReplicas: 5   240/200
desiredReplicas: 6   240/200
desiredReplicas: 6   240/200
desiredReplicas: 8   240/200
为什么autoscaler添加的POD超过2个

  behavior:
    scaleDown:
      stabilizationWindowSeconds: 10
      policies:
      - type: Pods
        value: 2
        periodSeconds: 2
    scaleUp:
      stabilizationWindowSeconds: 10
      policies:
      - type: Pods
        value: 2
        periodSeconds: 2
二,

我周期性地看到datadogmetric的验证是错误的,但同时datadogmetric获取度量并显示值

交付率真假252 beta/test-beta2 9s

这是错误消息

HPA controller was able to get the target''s current scale"},{"type":"ScalingActive","status":"False","lastTransitionTime":"2021-05-15T14:32:01Z","reason":"FailedGetExternalMetric","message":"the
      HPA was unable to compute the replica count: unable to get external metric beta/datadogmetric@beta:deliver-rate/nil:
      unable to fetch metrics from external metrics API: Internal error occurred:
      DatadogMetric is invalid, err: Outdated result from backend, query: rabbitmq.queue.messages.deliver.rate{environment:production,rabbitmq_queue:enqueue.dealroom-php.callable}.as_count()"},{"type":"ScalingLimited","status":"True","lastTransitionTime":"2021-05-15T14:30:57Z","reason":"TooManyReplicas","message":"the
      desired replica count is more than the maximum replica count"}]'
谁能帮我解决这两个问题