简体   繁体   English

Kuberentes HPA 更改轮询间隔

[英]Kuberentes HPA change polling interval

I use Horizontal Pod Autoscaler with External metric based on a value provided by DataDog agent我根据 DataDog 代理提供的值将 Horizontal Pod Autoscaler 与External指标一起使用

apiVersion: datadoghq.com/v1alpha1
kind: DatadogMetric
metadata:
  name: queue-size
spec:
  query: "max:redis.key.length{key:my-tasks}.fill(zero)"

Corresponding HPA configuration对应的 HPA 配置

apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: celery-worker
  metrics:
  - type: External
    external:
      metric:
        name: "datadogmetric@default:queue-size"

I want workers to be scaled almost immediately as queue grows, so need polling period to be at most 2-5 seconds.我希望随着队列的增长几乎立即扩展工作人员,因此需要轮询周期最多为2-5秒。 By default it's 30 seconds ( as per docs )默认情况下是 30 秒( 根据文档

在此处输入图像描述

How do I change poll interval on k8s side?如何更改 k8s 端的轮询间隔? Is there a flag when configuring HPA or should I tune DataDog agent instead?配置 HPA 时是否有标志,或者我应该调整 DataDog 代理吗?

Kubernetes implements horizontal pod autoscaling as a control loop that runs intermittently (it is not a continuous process). Kubernetes 将 pod 水平自动缩放实现为间歇运行的控制循环(它不是连续过程)。 The interval is set by the --horizontal-pod-autoscaler-sync-period parameter to the kube-controller-manager (and the default interval is 15 seconds).间隔由kube-controller-manager--horizontal-pod-autoscaler-sync-period参数设置(默认间隔为 15 秒)。 You should tweak the value as per your requirement您应该根据您的要求调整值

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM