Closed jeesmon closed 1 year ago
Hi @jeesmon, if you want to scrape all the pods backed by a service you'll need to annotate all the pods with prometheus.io/scrape
. The service-level annotation will scrape with the behavior of a K8s Service: each scrape request will be routed to a pod based on the load balancing algorithm of the Service in question.
@oppegard Thanks for the reply. As you can see load balancing a metrics point is not an intended behavior in many cases as each pod behind a service will have different metrics. If you look at the prometheus ServiceMonitor, the behavior is scraping from each endpoint behind the service so we get aggregated metrics from all pods.
Sorry for the confusion @jeesmon. We do not support the equivalent of the Prometheus Operator's ServiceMonitor
resource. We have raised this issue with our product management team for consideration though. We'll also try adding a note in our documentation to make the pod-level and service-level scrape behavior clearer.
According to the doc here:
If we annotate a service with
prometheus.io/scrape
, it is scraping metrics only from a single endpoint behind a service.From collector log:
But when curl'ing metrics endpoint directly from another pod
Each endpoint holds different sets of metrics but collector is getting metrics only from one endpoint.