Horizontal Pod Autoscaler
An example of HPA that scales up and down depending on CPU and memory consumption.
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: identity
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: deploymentname
minReplicas: 2
maxReplicas: 10
behavior:
scaleUp:
stabilizationWindowSeconds: 300
policies:
- type: Pods
value: 1
periodSeconds: 300
scaleDown:
stabilizationWindowSeconds: 300
policies:
- type: Pods
value: 1
periodSeconds: 300
selectPolicy: Min
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 50
- type: Resource
resource:
name: memory
target:
type: AverageValue
averageValue: 1000Mi