Files
kami_apple_exchage/backend/deploy/k8s/hpa.yaml
danial 108a8810e6 refactor: migrate to Apple Exchange backend architecture
Remove distributed crawler system and refactor backend to focus on Apple Gift Card Exchange functionality. Update deployment configurations and dependencies accordingly.
2025-08-26 23:39:47 +08:00

83 lines
1.8 KiB
YAML

# Horizontal Pod Autoscaler for API服务
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: apple-exchange-api-hpa
namespace: apple-exchange
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: apple-exchange-api
minReplicas: 3
maxReplicas: 10
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: 60
policies:
- type: Percent
value: 50
periodSeconds: 60
---
# Horizontal Pod Autoscaler for Worker服务
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: apple-exchange-worker-hpa
namespace: apple-exchange
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: apple-exchange-worker
minReplicas: 2
maxReplicas: 20
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 75
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 85
behavior:
scaleDown:
stabilizationWindowSeconds: 600 # 更长的稳定窗口,避免频繁缩容
policies:
- type: Percent
value: 25
periodSeconds: 120
scaleUp:
stabilizationWindowSeconds: 120
policies:
- type: Percent
value: 100
periodSeconds: 60
- type: Pods
value: 5
periodSeconds: 60
selectPolicy: Max