feat: Add HPA and VPA autoscaling configurations for telecom platform components

- Add api-server HPA with 2-10 replicas scaling on CPU (70%), memory (80%), HTTP requests (100/s), queue messages (1000)
- Add charging-engine HPA with 2-8 replicas scaling on CPU (75%), memory (85%), billing events (50/s)
- Add packet-gateway HPA with 2-12 replicas scaling on CPU (60%), memory (75%), packets (1000/s)
- Add web-dashboard HPA with 1-6 replicas scaling on CPU (70%), memory (80%), active sessions (50)
- Configure H
This commit is contained in:
nutcas3
2026-04-17 17:20:15 +03:00
parent 44ce95a9e9
commit 2b2818a412
2 changed files with 325 additions and 0 deletions
+218
View File
@@ -0,0 +1,218 @@
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: api-server-hpa
namespace: telecom-platform
labels:
app.kubernetes.io/name: api-server-hpa
app.kubernetes.io/component: autoscaling
app.kubernetes.io/part-of: telecom-platform
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: api-server
minReplicas: 2
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 80
- type: Pods
pods:
metric:
name: http_requests_per_second
target:
type: AverageValue
averageValue: "100"
- type: Object
object:
metric:
name: queue_messages
describedObject:
apiVersion: v1
kind: Service
name: api-server
target:
type: Value
value: "1000"
behavior:
scaleDown:
stabilizationWindowSeconds: 300
policies:
- type: Percent
value: 10
periodSeconds: 60
- type: Pods
value: 2
periodSeconds: 60
selectPolicy: Min
scaleUp:
stabilizationWindowSeconds: 60
policies:
- type: Percent
value: 50
periodSeconds: 60
- type: Pods
value: 4
periodSeconds: 60
selectPolicy: Max
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: charging-engine-hpa
namespace: telecom-platform
labels:
app.kubernetes.io/name: charging-engine-hpa
app.kubernetes.io/component: autoscaling
app.kubernetes.io/part-of: telecom-platform
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: charging-engine
minReplicas: 2
maxReplicas: 8
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 75
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 85
- type: Pods
pods:
metric:
name: billing_events_per_second
target:
type: AverageValue
averageValue: "50"
behavior:
scaleDown:
stabilizationWindowSeconds: 300
policies:
- type: Percent
value: 10
periodSeconds: 60
scaleUp:
stabilizationWindowSeconds: 60
policies:
- type: Percent
value: 100
periodSeconds: 60
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: packet-gateway-hpa
namespace: telecom-platform
labels:
app.kubernetes.io/name: packet-gateway-hpa
app.kubernetes.io/component: autoscaling
app.kubernetes.io/part-of: telecom-platform
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: packet-gateway
minReplicas: 2
maxReplicas: 12
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 60
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 75
- type: Pods
pods:
metric:
name: packets_per_second
target:
type: AverageValue
averageValue: "1000"
behavior:
scaleDown:
stabilizationWindowSeconds: 300
policies:
- type: Percent
value: 15
periodSeconds: 60
scaleUp:
stabilizationWindowSeconds: 30
policies:
- type: Percent
value: 200
periodSeconds: 60
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: web-dashboard-hpa
namespace: telecom-platform
labels:
app.kubernetes.io/name: web-dashboard-hpa
app.kubernetes.io/component: autoscaling
app.kubernetes.io/part-of: telecom-platform
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: web-dashboard
minReplicas: 1
maxReplicas: 6
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 80
- type: Pods
pods:
metric:
name: active_sessions
target:
type: AverageValue
averageValue: "50"
behavior:
scaleDown:
stabilizationWindowSeconds: 300
policies:
- type: Percent
value: 20
periodSeconds: 60
scaleUp:
stabilizationWindowSeconds: 60
policies:
- type: Percent
value: 100
periodSeconds: 60
+107
View File
@@ -0,0 +1,107 @@
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
name: api-server-vpa
namespace: telecom-platform
labels:
app.kubernetes.io/name: api-server-vpa
app.kubernetes.io/component: autoscaling
app.kubernetes.io/part-of: telecom-platform
spec:
targetRef:
apiVersion: apps/v1
kind: Deployment
name: api-server
updatePolicy:
updateMode: "Auto"
resourcePolicy:
containerPolicies:
- containerName: api-server
minAllowed:
cpu: 100m
memory: 128Mi
maxAllowed:
cpu: 2000m
memory: 2Gi
controlledResources: ["cpu", "memory"]
---
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
name: charging-engine-vpa
namespace: telecom-platform
labels:
app.kubernetes.io/name: charging-engine-vpa
app.kubernetes.io/component: autoscaling
app.kubernetes.io/part-of: telecom-platform
spec:
targetRef:
apiVersion: apps/v1
kind: Deployment
name: charging-engine
updatePolicy:
updateMode: "Auto"
resourcePolicy:
containerPolicies:
- containerName: charging-engine
minAllowed:
cpu: 100m
memory: 128Mi
maxAllowed:
cpu: 1500m
memory: 1.5Gi
controlledResources: ["cpu", "memory"]
---
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
name: packet-gateway-vpa
namespace: telecom-platform
labels:
app.kubernetes.io/name: packet-gateway-vpa
app.kubernetes.io/component: autoscaling
app.kubernetes.io/part-of: telecom-platform
spec:
targetRef:
apiVersion: apps/v1
kind: Deployment
name: packet-gateway
updatePolicy:
updateMode: "Auto"
resourcePolicy:
containerPolicies:
- containerName: packet-gateway
minAllowed:
cpu: 100m
memory: 128Mi
maxAllowed:
cpu: 3000m
memory: 3Gi
controlledResources: ["cpu", "memory"]
---
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
name: web-dashboard-vpa
namespace: telecom-platform
labels:
app.kubernetes.io/name: web-dashboard-vpa
app.kubernetes.io/component: autoscaling
app.kubernetes.io/part-of: telecom-platform
spec:
targetRef:
apiVersion: apps/v1
kind: Deployment
name: web-dashboard
updatePolicy:
updateMode: "Auto"
resourcePolicy:
containerPolicies:
- containerName: web-dashboard
minAllowed:
cpu: 50m
memory: 64Mi
maxAllowed:
cpu: 1000m
memory: 1Gi
controlledResources: ["cpu", "memory"]