Kubernetes Cluster Autoscaler: Custom metric aggregation

10/31/2019

I'm running a Google Kubernetes Engine cluster. I have a Google cloud Custom-Metric in the path:

custom.googleapis.com|web|NAME|2xx

I want to create an autoscaling rule that will scale my deployment according to the number of calls.

apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
  name: NAME
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: NAME
  minReplicas: 2
  maxReplicas: 6
  metrics:
  - type: External
    external:
      metricName: "custom.googleapis.com|web|NAME|2xx"
      targetValue: 500

This autoscaling rule is working good if custom.googleapis.com|web|NAME|2xx is a single value. In my case, I have to create a SUM aggregation function to get the actual value.

enter image description here

See the highlighted (in yellow) part.

How I can update my metricName field in order to SUM all the values?

-- No1Lives4Ever
google-cloud-monitoring
google-cloud-platform
google-kubernetes-engine
kubernetes
stackdriver

0 Answers