I have a pod which exposes two port. One exports metrics via /metrics and the other is not.
When I configure prometheus with the following config:
- job_name: default_ns
kubernetes_sd_configs:
- role: pod
namespaces:
names:
- default
I see that for each pod, all the ports are being scraped. The port which doesn't have the /metrics enabled, is failing the scrape - which is expected.
I'm wondering if there's a way to be more explicit about telling prometheus which ports to scrape (and which not to scrape). I'm not sure this is possible, as per the documentation for pod roles:
For each declared port of a container, a single target is generated
Is there a way to achieve something like this?
Thanks.