Skip to content

Instantly share code, notes, and snippets.

@chadmcrowell
Created March 8, 2025 14:33
Show Gist options
  • Save chadmcrowell/5feb290dc78f8d2868eb8d3ebdbb1683 to your computer and use it in GitHub Desktop.
Save chadmcrowell/5feb290dc78f8d2868eb8d3ebdbb1683 to your computer and use it in GitHub Desktop.
HPA with Stabilization window
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: nginx-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: nginx-deployment
minReplicas: 2
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 50
behavior:
scaleDown:
stabilizationWindowSeconds: 300 # 5 minutes
policies:
- type: Percent
value: 10
periodSeconds: 60
scaleUp:
stabilizationWindowSeconds: 0 # Immediate scaling up
policies:
- type: Pods
value: 4
periodSeconds: 60
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment