title: HorizontalPodAutoscaler scaling based on custom metrics - node-pool level metric
body: <p>I am currently trying to set up a GKE cluster and to configure an <code>HorizontalPodAutoscaler</code> based on a custom metric (GPU consumption).
  I have two node-pools and I want to horizontally scale them based on the average GPU consumption of <strong>each</strong> <code>node_pool</code>. I have configured two identical HPA like this:</p>
  <pre><code>apiVersion: autoscaling/v2beta2
  kind: HorizontalPodAutoscaler
  metadata:
    name: ner
  spec:
    scaleTargetRef:
      apiVersion: apps/v1
      kind: Deployment
      name: ner
    minReplicas: 1
    maxReplicas: 10
    metrics:
      - type: External
        external:
          metric:
            name: kubernetes.io|container|accelerator|duty_cycle
          target:
            type: AverageValue
            averageValue: 60
  </code></pre>
  <p>where I only replace the <code>scaleTargetRef</code> but it turns out that this metric seems to be aggregated at a cluster level. I have double checked that the <code>scaleTargetRef</code> are properly defined.</p>
  <p>Is there a way to filter the metrics by <code>container_name</code> or <code>node_pool</code>? Any other suggestion would be awesome !</p>