1
2022-08-17T16:14:15.5682728Z error: error validating "deployment.yml": error validating data: ValidationError(HorizontalPodAutoscaler.spec.metrics[1].resource.target.averageUtilization): invalid type for io.k8s.api.autoscaling.v2.MetricTarget.averageUtilization: got "string", expected "integer"; if you choose to ignore these errors, turn validation off with --validate=false
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: hpa-xyz
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: StatefulSet
    name: XYZ
  minReplicas: ${MinRequestForwarderReplicas}
  maxReplicas: ${MaxRequestForwarderReplicas}
  metrics:
  - type: Resource
    resource:
      name: cpu
      target:
        type: Utilization
        averageUtilization: 75
  - type: Resource
    resource:
      name: memory
      target:
        type: Utilization
        averageUtilization: 1500Mi

I tried the memory "averageUtilization" values with 1.5Gi and "1.5Gi" with double quotes. Can anyone check and let me know if I am missing something here?

1 Answers1

1
averageUtilization: 

is represented as a percent of requested memory. So you're wrong with Mi.

It should be.

averageUtilization: 65 

Specify averageUtilization and a target average memory utilization over all the pods, represented as a percent of requested memory. The target pods must have memory requests configured.

Thanh Nguyen Van
  • 10,292
  • 6
  • 35
  • 53
  • 1
    Thanks. https://access.redhat.com/documentation/en-us/openshift_container_platform/4.5/pdf/nodes/openshift_container_platform-4.5-nodes-en-us.pdf Page-31 in this link was also mentioning the same. Appreciate your help! – Arun Prakash Nagendran Aug 18 '22 at 04:11
  • If I use the actual value, then I can provide the actual value. target: type: AverageValue 10 averageValue: 500Mi – Arun Prakash Nagendran Aug 18 '22 at 04:13