apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
  name: mlflow-api
  namespace: machine-learning
spec:
  maxReplicas: 4
  minReplicas: 1
  scaleTargetRef:
    apiVersion: apps/v1beta1
    kind: Deployment
    name: mlflow-api
  metrics:
    - type: Pods
      pods:
        metric:
          name: request_rate_last_2_min
          selector:
            matchLabels:
              direction: inbound
        target:
          type: AverageValue
          averageValue: 4
