Skip to main content

☑️ Ensure HPA has minimum replicas configured

When auto-scaling resource utilization is triggered with HPA (HorizontalPodAutoscaler), a range of acceptable values must be set to prevent unintended scaling down scenarios.

Targeted objects by this rule (types of kind): HorizontalPodAutoscaler

Complexity: medium (What does this mean?)

Policy as code identifier: HPA_MISSING_MINREPLICAS_KEY


This rule will fail​

If an HPA doesn't have minimum replicas configured

kind: HorizontalPodAutoscaler
spec:
maxReplicas: 10

Rule output in the CLI​

$ datree test *.yaml

>> File: failExample.yaml
❌ Ensure HPA has minimum replicas configured [1 occurrence]
💡 Missing property object `minReplicas` - the value should be within the accepted boundaries recommended by the organization

How to fix this failure​

kind: HorizontalPodAutoscaler
spec:
minReplicas: 1
maxReplicas: 10

Read more​