<p>I've installed the <a href="https://github.com/helm/charts/tree/master/stable/prometheus-operator" rel="nofollow noreferrer">prometheus-operator</a> by helm 3:</p>
<pre><code>helm install prom stable/prometheus-operator --namespace monitor
</code></pre>
<p>But I also want to set the namespace for the service discovery which is &quot;default&quot; in the standard installation.</p>
<p>When I <a href="http://localhost:9090/config" rel="nofollow noreferrer">query the prometheus config</a>, I see this:</p>
<pre><code>kubernetes_sd_configs:
- role: endpoints
  namespaces:
    names:
    - default
</code></pre>
<p>I've checked the documentation of the <a href="https://github.com/helm/charts/tree/master/stable/prometheus-operator" rel="nofollow noreferrer">prometheus-operator</a>, but I can't find an option of how to change the default namespace.</p>
<p>There's a parameter <code>serviceMonitorNamespaceSelector</code>, but this seems to search the serviceMonitor itself in the namespace.</p>

Matthias M
<p>A ServiceMonitor object should be created in the required namespace with proper labels for Prometheus Operator to process it.</p>
<p>Refer to <a href="https://coreos.com/operators/prometheus/docs/latest/api.html#servicemonitorspec" rel="nofollow noreferrer">https://coreos.com/operators/prometheus/docs/latest/api.html#servicemonitorspec</a>.</p>
