Search code examples
kuberneteshorizontal-scalinghpahorizontal-pod-autoscalinghorizontalpodautoscaler

Kubernetes HorizontalPodAutoscaler Scale in multiples of 3


We want our deployment to have 3/6/9/etc replicas at all times to have an even AZ spread. Is there a way to achieve this via HPA config ?


Solution

  • You can use the Scaling policy with the HPA

    Example

    scaleUp:
        stabilizationWindowSeconds: 0
        policies:
        - type: Pods
          value: 3
          periodSeconds: 5
        selectPolicy: Max
    

    it will add the 3 PODs every 5 second until HPA metrics become steady.

    Ref doc : https://github.com/kubernetes/enhancements/blob/master/keps/sig-autoscaling/853-configurable-hpa-scale-velocity/README.md