Prometheus-operator and Prometheus were installed separately using the help chart.
For convenience, serviceMonitorNamespaceSelector and PodMonitorNamespaceSelecotr were specified in the namespace where Prometheus was deployed.
I would like to create a servicemonitor and connect endpoints to collect specific metrics such as a separate solution (Gitalb, Rook-ceph).
Gitlab and Rook-ceph are installed in separate OS, and namespace is different.
However, the ServiceMonitor does not appear in the Prometheus Target.
Is there anything I missed?
# rook-ceph service && servicemonitor
apiVersion: v1
kind: Service
metadata:
creationTimestamp: "2021-12-02T12:11:58Z"
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: "335184"
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
# prometheus install yaml
serviceMonitorNamespaceSelector:
matchLabels:
name: prometheus
serviceMonitorSelectorNilUsesHelmValues: false
podMonitorNamespaceSelector:
matchLabels:
name: prometheus
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
