prometheus-operator icon indicating copy to clipboard operation
prometheus-operator copied to clipboard

Support multiple prometheus instances

Open ebuildy opened this issue 3 years ago • 8 comments

What is missing?

In a case with multiple prometheus instances.

Allow in a same namespace, differents PodMonitor / ServiceMonitor to select prometheus instance, via a selector (namespaceSelector etc...).

Why do we need it?

We run a global prometheus and prometheus by team in order to separate software and business metrics.

Example: "rabbitmq must be scraped by global prometheus, whereas the nodejs app by team prometheus".

Environment

on-premise k8s cluster.

  • Prometheus Operator version:

    v0.50.0

Anything else we need to know?:

ebuildy avatar Apr 15 '22 08:04 ebuildy

Can you use the podMonitorSelector and serviceMonitorSelector fields on the Prometheus object instead?

fpetkovski avatar Apr 19 '22 09:04 fpetkovski

I am not sure, this is for prometheus instance. I would like select the prometheus namespace that will scrap the PodMonitor

ebuildy avatar Apr 20 '22 10:04 ebuildy

This works the other way around: pod monitors can't select which Prometheus instance(s) will scrape the targeted pods.

simonpasquier avatar Apr 20 '22 10:04 simonpasquier

thanks you. Thats why I post this as a feature request.

ebuildy avatar Apr 20 '22 14:04 ebuildy

Not sure why the Prometheus object selecting service/pod monitors by labels doesn't fit your case. Would you mind providing more details?

simonpasquier avatar Apr 20 '22 15:04 simonpasquier

Think of a setup like https://istio.io/latest/docs/ops/best-practices/observability, where Production Prometheus instance is launched using Prometheus Operator and Istio Prometheus instance is not launched using Prometheus Operator.

Does this mean we can't use Prometheus Operator to add a PrometheusRule to Istio Prometheus instance?

ruiengana avatar May 12 '22 16:05 ruiengana

@ruiengana I'm not following here: if the operator isn't managing Istio Prometheus, not sure how/why this Prometheus instance would be configured with PrometheusRule objects.

simonpasquier avatar May 13 '22 09:05 simonpasquier

@ruiengana I'm not following here: if the operator isn't managing Istio Prometheus, not sure how/why this Prometheus instance would be configured with PrometheusRule objects.

It's clear :) I now understand that it's Prometheus CRD object with it's match labels that will look our for ServiceMonitor and PrometheusRule objects to execute.

As the creator of this issue, I was thinking that it worked in the reverse direction, e.g. to be the PrometheusRule that selected which Prometheus instance to apply.

ruiengana avatar May 13 '22 09:05 ruiengana

btw, it would be nice feature - I'm trying to build federation and looks like it's impossible with operator.

Punkoivan avatar May 24 '23 08:05 Punkoivan

Hi @Punkoivan! For federation, here's an issue that'll help enable it: https://github.com/prometheus-operator/prometheus-operator/issues/5592

xiu avatar May 24 '23 10:05 xiu

@Punkoivan I'm not sure how your remark relates to this issue but it would help if you provide more details. With a few quirks you can create a federation target from a ServiceMonitor/PodMonitor.

simonpasquier avatar May 24 '23 12:05 simonpasquier