Custom metrics prometheus exporter HPA

Horizontal Pod Autoscaler for prometheus exporter to Cloud Monitoring.

Code sample

YAML

apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: custom-metrics-gmp-hpa
  namespace: default
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: custom-metrics-gmp
  minReplicas: 1
  maxReplicas: 5
  metrics:
  - type: Pods
    pods:
      metric:
        name: prometheus.googleapis.com|custom_prometheus|gauge
      target:
        type: AverageValue
        averageValue: 20

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.