title: prometheus operator target not showing
body: <p>Prometheus-operator and Prometheus were installed separately using the help chart.</p>
  <p>For convenience, serviceMonitorNamespaceSelector and PodMonitorNamespaceSelecotr were specified in the namespace where Prometheus was deployed.</p>
  <p>I would like to create a servicemonitor and connect endpoints to collect specific metrics such as a separate solution (Gitalb, Rook-ceph).</p>
  <p>Gitlab and Rook-ceph are installed in separate OS, and namespace is different.</p>
  <p>However, the ServiceMonitor does not appear in the Prometheus Target.</p>
  <p>Is there anything I missed?</p>
  <pre><code># rook-ceph service &amp;&amp; servicemonitor
  apiVersion: v1
  kind: Service
  metadata:
    creationTimestamp: &quot;2021-12-02T12:11:58Z&quot;
    labels:
      app: rook-ceph-mgr
      ceph_daemon_id: a
      rook_cluster: rook-ceph
    name: rook-ceph-mgr
    namespace: rook-ceph
    ownerReferences:
    - apiVersion: ceph.rook.io/v1
      blockOwnerDeletion: true
      controller: true
      kind: CephCluster
      name: rook-ceph
      uid: 39e4d63d-af59-4698-9d38-513bed86d7ab
    resourceVersion: &quot;335184&quot;
    uid: 3c3ccfe9-9c3c-482b-85a9-fc694d5c3da8
  spec:
    clusterIP: 10.43.165.239
    clusterIPs:
    - 10.43.165.239
    ipFamilies:
    - IPv4
    ipFamilyPolicy: SingleStack
    ports:
    - name: http-metrics
      port: 9283
      protocol: TCP
      targetPort: 9283
    selector:
      app: rook-ceph-mgr
      ceph_daemon_id: a
      rook_cluster: rook-ceph
    sessionAffinity: None
    type: ClusterIP
  ---
  apiVersion: monitoring.coreos.com/v1
  kind: ServiceMonitor
  metadata:
    name:  rook-ceph-mgr
    namespace: rook-ceph
    labels:
      app: rook-ceph-mgr
      ceph_daemon_id: a
      rook_cluster: rook-ceph
      release: prometheus
  spec:
    endpoints:
    - path: /metrics
      port: http-metrics
      scheme: http
      interval: 5s
    selector:
      matchLabels:
        app: rook-ceph-mgr
        rook_cluster: rook-ceph
        ceph_daemon_id: a
    namespaceSelector:
      matchNames:
      - rook-ceph
  </code></pre>
  <pre><code># prometheus install yaml
      serviceMonitorNamespaceSelector:
        matchLabels:
          name: prometheus
      serviceMonitorSelectorNilUsesHelmValues: false
      podMonitorNamespaceSelector:
        matchLabels:
          name: prometheus
  </code></pre>
  <pre><code>root@server1:~# kubectl get servicemonitor -A
  NAMESPACE    NAME                                                 AGE
  prometheus   prometheus-kube-prometheus-alertmanager              39d
  prometheus   prometheus-kube-prometheus-apiserver                 39d
  prometheus   prometheus-kube-prometheus-coredns                   39d
  prometheus   prometheus-kube-prometheus-grafana                   39d
  prometheus   prometheus-kube-prometheus-kube-controller-manager   39d
  prometheus   prometheus-kube-prometheus-kube-etcd                 39d
  prometheus   prometheus-kube-prometheus-kube-proxy                39d
  prometheus   prometheus-kube-prometheus-kube-scheduler            39d
  prometheus   prometheus-kube-prometheus-kube-state-metrics        39d
  prometheus   prometheus-kube-prometheus-kubelet                   39d
  prometheus   prometheus-kube-prometheus-node-exporter             39d
  prometheus   prometheus-kube-prometheus-prometheus                39d
  prometheus   rke2-ingress-nginx-controller                        39d
  rook-ceph    rook-ceph-mgr                                        23m
  </code></pre>
  <p><img src="https://i.stack.imgur.com/ugYkI.png" alt="enter image description here" /></p>