Let's say I have multiple pods (replicas) of application under a service (with targetPort pointing to port where application keeps its metrics for Prometheus) named "app-monitor-service". Right now I am getting metrics from pods directly using kubernetes_sd_config and is working fine.

Can I use static_config and point Prometheus to scrape from that service?

Logically scraping from service may seem to work as service routes requests in round robin fashion, Prometheus should be able to scrape metrics from all pods, but want to validate, if I am correct.

1 Answer 1


Scraping through any kind of load balancer in not advised. Even though you have round robin managing of requests, pod will have slightly different values of metrics, and this will only increase confusion around them.

Additionally things like counters and histograms will have particularly bad time in this setup:
you'll see unexpected resets, that couldn't be correctly accounted by functions like rate and increase.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.