veza/k8s/autoscaling/hpa-chat-server.yaml
senke 652d474cc1 [INFRA-012] infra: Set up auto-scaling
🎉 ALL 267 TASKS COMPLETED! 🎉
2025-12-25 21:43:00 +01:00

51 lines
1.1 KiB
YAML

# Horizontal Pod Autoscaler for Chat Server
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: veza-chat-server-hpa
namespace: veza-production
labels:
app: veza-chat-server
component: autoscaling
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: veza-chat-server
minReplicas: 2
maxReplicas: 15
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 80
behavior:
scaleUp:
stabilizationWindowSeconds: 60
policies:
- type: Percent
value: 100
periodSeconds: 15
- type: Pods
value: 3
periodSeconds: 15
selectPolicy: Max
scaleDown:
stabilizationWindowSeconds: 600 # Longer for WebSocket connections
policies:
- type: Percent
value: 10
periodSeconds: 60
- type: Pods
value: 1
periodSeconds: 60
selectPolicy: Min