How to scrape multiple ports and end-points of a POD using service discovery?

Hi,

I have a strange UC, POD having 4 containers that expose metrics on different ports, end-points, and schemes. I can’t place Prometheus annotations as I have multiple ports that expose metrics.

Does Prometheus Auto-Discovery on K8S support this? or Do I need to use Prometheus Operator?

Thanks!
Teja

1 Like

Hi Tejaswini, How did you manage to fix it ?
Thanks in advance

In the Prometheus UP & Running book, we have a recommendation to use prometheus.io/pathN annotation where N >=2

@Tejaswini I’m facing kind of similar issue. I have an application where it exposes to 3 ports. So I’m exposing them to different paths with respective ports.

But below config is not working. Could you please help.
prometheus.io/app1_path: path
prometheus.io/app1_port: 1010

also
prometheus.io/scrape: true