Prometheus Operator — Service Monitor auto discovery across all namespaces

Denis Biondic
CoffeeApplied Blog | Denis Biondic
1 min readOct 23, 2018

--

A quick tip which took me quite some time to figure out, is how to configure the Prometheus CRD (monitoring.coreos.com/v1) so that it picks up all the Service Monitor definitions in all cluster namespaces.

Most of the examples mention only serviceMonitorSelector, but this only affects selection inside the same namespace where the Prometheus is deployed.

The solution is simply to use serviceMonitorNamespaceSelector as well:

--

--