Kubernetes creates the Endpoints object based on the Service object. Does
it carry over the annotations while doing that? If so, you are getting
returns in both SD configs because there are two objects in Kubernetes to
be discovered.

I would suggest using a different value for the scrape annotation, and
matching on that in the service SD configuration, to distinguish whether
you want this thing scraped once or for each instance.

/MR

On Tue, Apr 7, 2020 at 3:37 AM Patrick Schless <[email protected]>
wrote:

> I'm using prometheus on k8s, and trying to add an annotation to my service
> for the service discovery. The metrics I'm exposing are business-level (eg
> "# of customers") so I don't need all pods queried. Querying the service
> once (with a random pod) is sufficient. As I understand it, there is a
> service discovery role applicable: "service".
>
> However, when I add this annotation to my service, it is "discovered" by
> the endpoints role, which then tries to hit all downstream pods.
>
> prometheus.io/scrape: true
>>
>
>
> The docs clearly make a distinction between service SD and endpoints SD,
> but it's not clear to me now to choose one or the other.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Prometheus Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/prometheus-users/bbec2f68-afea-4366-8156-b729bc04b373%40googlegroups.com
> <https://groups.google.com/d/msgid/prometheus-users/bbec2f68-afea-4366-8156-b729bc04b373%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/CAMV%3D_gZiPkiBqjy9EpS_CHarZhDUTzYdJBxUwq%3DQtRv%2BjErxGQ%40mail.gmail.com.

Reply via email to