HPA — automatically scales Pod replicas based on metrics.
1apiVersion: autoscaling/v22kind: HorizontalPodAutoscaler3metadata:4 name: myapp-hpa5spec:6 scaleTargetRef:7 apiVersion: apps/v18 kind: Deployment9 name: myapp10 minReplicas: 211 maxReplicas: 1012 metrics:13 - type: Resource14 resource:15 name: cpu16 target:17 type: Utilization18 averageUtilization: 7019 - type: Resource20 resource:21 name: memory22 target:23 type: Utilization24 averageUtilization: 80
1kubectl get hpa2kubectl describe hpa myapp-hpa3kubectl autoscale deployment myapp --min=2 --max=10 --cpu-percent=70
Requirements: