【问题标题】:HorizontalPodAutoscaler multiple replica upscaleHorizo​​ntalPodAutoscaler 多副本升级
【发布时间】:2018-10-04 23:27:00
【问题描述】:

我在 Kubernetes 中使用 Horizo​​ntal Pod Autoscaler,如下所示。我想将它用于在 4 到 40 个副本之间扩展的服务。不幸的是,由于高档延迟,从 4 个副本扩展到 40 个副本大约需要一个小时。我有没有机会为高档副本提供像最小/最大 Surge 之类的东西?这样它至少会升级 2 或 4 个副本?

我的 API 对象(掌舵):

apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
  name: {{ required "A valid service.name entry required!" .Values.service.name }}
  labels:
    app: {{ .Values.service.name }}
    version: {{ .Values.image.tag | quote }}
    chart: {{ template "nodejs.chart" . }}
    release: "{{ .Release.Name }}-{{ .Values.image.tag }}"
    heritage: {{ .Release.Service }}
spec:
  scaleTargetRef:
    apiVersion: apps/v1beta1
    kind: Deployment
    name: {{ required "A valid service.name entry required!" .Values.service.name }}
  minReplicas: {{ .Values.autoscaling.minReplicas }}
  maxReplicas: {{ .Values.autoscaling.maxReplicas }}
  metrics:
  - type: Resource
    resource:
      name: cpu
      targetAverageValue: {{ required "A valid autoscaling.cpuTargetValue entry is required" .Values.autoscaling.cpuTargetValue }}
  - type: Resource
    resource:
      name: memory
      targetAverageValue: {{ required "A valid autoscaling.memoryTargetValue entry is required" .Values.autoscaling.memoryTargetValue }}

【问题讨论】:

    标签: kubernetes


    【解决方案1】:

    不是真的。您似乎担心抖动。没有真正的方法来定义高档 step 数字与冷静期相结合。

    在 Kubernetes 1.11 之前,您可以在 kube-controller-manager 上指定 --horizontal-pod-autoscaler-upscale-delay,默认为 3 分钟。这可能还不够,所以我创建了这个issue

    因此,从 Kubernetes 1.12 开始,该选项已被删除,取而代之的是 better scaling algorithm

    【讨论】:

    • 我知道高档延迟,但是延迟是有道理的,3分钟对我来说也应该没问题。但是,您运行的副本越多,单个 pod 向上/向下缩放对整体负载的影响就越小。这是否反过来意味着 HPA 不适合具有许多副本的部署?那我会很失望的。
    • 它应该能够处理数千个新副本,但还有其他因素,并因情况而异。例如,您正在运行什么应用程序?您的应用程序是否需要大量 CPU 突发?无论如何,这就是为什么打开票证并看起来像是在 1.12 中进行了一些修复
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-04-30
    • 2019-07-21
    • 1970-01-01
    • 1970-01-01
    • 2011-12-20
    • 2020-09-11
    • 2014-11-27
    相关资源
    最近更新 更多