<pre><code>Kubernetes version - v1.11.2
Prometheus helm chart version - 6.7.0     
</code></pre>

<p>I have my service running on 2 ports - 80 and 9000
Now I only need to monitor port 80 and I used below configuration to achieve that.</p>

<pre><code>- job_name: '&lt;service-name&gt;'
          honor_labels: true
          kubernetes_sd_configs:
            - role: service
          relabel_configs:
            - source_labels: [__meta_kubernetes_service_label_app]
              action: keep
              regex: &lt;service-name&gt;
            - source_labels: [__meta_kubernetes_service_name]
              action: replace
              target_label: kubernetes_name
</code></pre>

<p>The above solution adds both the service endpoint in Prometheus</p>

<pre><code>http://&lt;service-name&gt;.default.svc:80/metrics
http://&lt;service-name&gt;.default.svc:9000/metrics
</code></pre>

<p>To scrape only port 80 I added below config but its not able to scrape any service endpoints now.</p>

<pre><code>- source_labels: [__meta_kubernetes_service_port_number]
              action: keep
              regex: 8\d{1}
</code></pre>

<p>Is there a way to only restrict specific port numbers?</p>

Darshan Deshmukh
<p>I had a similar issue, specifying the port in the relabel_configs worked for me.</p>

<pre><code>relabel_configs: 
  - source_labels : [__meta_kubernetes_pod_label_app,__meta_kubernetes_pod_container_port_number]
    action: keep
    regex: myapp;8081
</code></pre>

<p>After this my service was getting scraped only for port 8081</p>
