title: Prometheus scrape config for multiple metric endpoints per pod
body: <p>We have a Kubernetes Pod which provides multiple metric endpoints (<code>:3093/metrics</code> and <code>:9113/metrics</code>), but it also has an port which doesn't provide any metric (<code>:80</code>).</p>
  
  <p><strong>TL;DR:</strong> Is is possible to scrape only the ports <code>3093</code> and <code>9113</code>?</p>
  
  <hr>
  
  <p>We are using <a href="https://github.com/prometheus/prometheus/blob/70f3d1e/documentation/examples/prometheus-kubernetes.yml" rel="nofollow noreferrer">the example configuration</a> for the scrape configuration:</p>
  
  
  
  <pre><code>- job_name: 'kubernetes-pods'
    tls_config:
      insecure_skip_verify: true
    kubernetes_sd_configs:
    - role: pod
    relabel_configs:
    - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
      action: keep
      regex: true
    - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path]
      action: replace
      target_label: __metrics_path__
      regex: (.+)
    - source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port]
      action: replace
      regex: ([^:]+)(?::\d+)?;(\d+)
      replacement: $1:$2
      target_label: __address__
    - action: labelmap
      regex: __meta_kubernetes_pod_label_(.+)
    - source_labels: [__meta_kubernetes_namespace]
      action: replace
      target_label: kubernetes_namespace
    - source_labels: [__meta_kubernetes_pod_name]
      action: replace
      target_label: kubernetes_pod_name
  </code></pre>
  
  <p>These endpoints get properly scraped, when enabling scraping with this annotation:</p>
  
  <pre><code>  annotations:
      prometheus.io/scrape: "true"
  </code></pre>
  
  <p>But this has the issue, that it also scrapes port <code>:80</code>, which it shouldn't.</p>