问题描述
我最后几天正在阅读和使用基于 HPA 的 Datadog 指标。 在我把文件下
https://www.datadoghq.com/blog/autoscale-kubernetes-datadog/ https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/
这是我的 Datadogmetric
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
我有两个问题
1.
当指标值高于定义的目标值时,所有这些都有效,但每次都没有以正确的方式扩大规模。例如,在 I 下放置 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
behavior:
scaleDown:
stabilizationWindowSeconds: 10
policies:
- type: Pods
value: 2
periodSeconds: 2
scaleUp:
stabilizationWindowSeconds: 10
policies:
- type: Pods
value: 2
periodSeconds: 2
2.
我定期看到 datadogmetric 的验证是错误的,但同时 datadogmetric 获取了指标并显示了值
deliver-rate True False 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"}]'
谁能帮我解决这两个问题?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)