academia/deploy/k3s/hpa.yaml

62 lines
1.2 KiB
YAML

---
# Horizontal Pod Autoscaler para API
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: student-api-hpa
namespace: academia
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: student-api
minReplicas: 1
maxReplicas: 5
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 80
behavior:
scaleDown:
stabilizationWindowSeconds: 300
policies:
- type: Percent
value: 10
periodSeconds: 60
scaleUp:
stabilizationWindowSeconds: 0
policies:
- type: Percent
value: 100
periodSeconds: 15
---
# HPA para Frontend
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: student-frontend-hpa
namespace: academia
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: student-frontend
minReplicas: 1
maxReplicas: 4
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 80