设置极限CPU水平Pod自动缩放比例

时间:2019-01-09 07:29:54

标签: kubernetes google-kubernetes-engine kubernetes-ingress

为什么人们

我试图在HPA上设置PCU目标。默认情况下为 80%,我想将其设置为 30%

在我的 hpa-pod.yaml 中,添加了值 targetCPUUtilizationPercentage ,但它不会覆盖我不了解的默认值。我是否误会了菜谱?

NAME                                          REFERENCE                TARGETS   MINPODS   MAXPODS   REPLICAS   AGE
horizontalpodautoscaler.autoscaling/hpa-pod   Deployment/cas-dp-ap   0%/80%    1         4         1          5m

-

metrics:
- type: Resource
  resources:
    name: cpu
    targetCPUUtilizationPercentage: 30

1 个答案:

答案 0 :(得分:1)

我的问题的解决方案是从指标中删除所有阻止以命名

apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
  labels:
    chart: value-given-by-helm
    release: cas-dp-ap
  name: hpa-pod
  namespace: xxx
spec:
  maxReplicas: 4
  minReplicas: 1
  scaleTargetRef:
    apiVersion: apps/v1beta1
    kind: Deployment
    name: cas-dp-ap
  targetCPUUtilizationPercentage: 30