set limit CPU Horizontal Pod Autoscaling in pourcent

1/9/2019

hy folks

i try to set up in pourcent the PCU target on HPA. By default it's 80% and i would want to set it to 30%

in my hpa-pod.yaml i add the value targetCPUUtilizationPercentage but it doesn't overwrite the default value i dont understand . did i mistake a prameters ?

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
-- morla
google-kubernetes-engine
kubernetes
kubernetes-ingress

1 Answer

1/9/2019

the solution of my problem was to remove all the block from metrics to name

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
-- morla
Source: StackOverflow