Skip to main content

β˜‘οΈ Ensure HPA has maximum replicas configured

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

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

Complexity: medium (What does this mean?)

Policy as code identifier: HPA_MISSING_MAXREPLICAS_KEY


This rule will fail​

If an HPA doesn't have maximum replicas configured

kind: HorizontalPodAutoscaler
spec:
minReplicas: 1

Rule output in the CLI​

$ datree test *.yaml

>> File: failExample.yaml
❌ Ensure HPA has maximum replicas configured [1 occurrence]
πŸ’‘ Missing property object `maxReplicas` - 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​