Dlaczego domyślne ustawienia HPA nie działają i jak skonfigurować skalowanie, które rzeczywiście oszczędza pieniądze.
Horizontal Pod Autoscaler w Kubernetes brzmi świetnie w teorii, ale w praktyce większość zespołów ma z nim problemy. Dlaczego?
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: webapp-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: webapp
minReplicas: 2
maxReplicas: 50
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
scaleDown:
stabilizationWindowSeconds: 300
policies:
- type: Percent
value: 10
periodSeconds: 60
- type: Pods
pods:
metric:
name: http_requests_per_second
target:
type: AverageValue
averageValue: "100"
| Scenario | Recommendation | Powód | |----------|---------------|--------| | Predictable load | HPA | Lepszy cost control | | Variable workload | HPA + VPA | Optimal resource usage | | Batch jobs | VPA only | Single execution optimization | | Microservices | HPA | Better availability |
Problemy z Kubernetes scaling? Umów konsultację.