apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
  name: helloworld
spec:
  maxReplicas: 20
  minReplicas: 2
  scaleTargetRef:
    apiVersion: apps/v1beta1
    kind: Deployment
    name: helloworld
  metrics:
  - type: Object
    object:
      target:
        kind: Service
        name: custom-metrics
      metricName: nginx_connections_current{state="writing"}
      targetValue: 5
