我正在使用 HPA(HorizontalPodAutoscaling) 以及 kubernetes 中的自定义指标。我可以根据我的自定义指标值来扩展我的 pod 数量。
kind: HorizontalPodAutoscaler
apiVersion: autoscaling/v2alpha1
metadata:
name: sample-metrics-app-hpa
spec:
scaleTargetRef:
kind: Deployment
name: sample-metrics-app
minReplicas: 2
maxReplicas: 10
metrics:
- type: Object
object:
target:
kind: Service
name: sample-metrics-app
metricName: http_requests
targetValue: 100
是否可以定义多个目标值,例如,如果 http 请求达到 100,则 pod 应缩放 10(为此,最小副本应为 2),如果达到 1000,则 pod 应缩放 20(最小副本需要为 10)。