44
55![ Architecture] ( federation/assets/cmo-obo-federation.png )
66
7- This example deploys a MonitoringStack in ` federate-cmo ` namespace and ingests
8- only a selected set of metrics from the in-cluster Prometheus.
7+ This example deploys a MonitoringStack in the ` federate-cmo ` namespace and ingests
8+ only a selected set of metrics from the in-cluster Prometheus stack .
99
1010## Steps
1111
12- Assuming that ObO is installed, follow the steps below to create a
12+ Assuming that the Observability Operator is installed, follow the steps below to create a
1313MonitoringStack that uses the in-cluster Prometheus ` /federate ` endpoint to
1414scrape selected metrics.
1515
@@ -18,17 +18,20 @@ directory](federation/manifests)
1818
1919### Create a Project to deploy MonitoringStack
2020
21-
2221``` yaml
2322apiVersion : v1
2423kind : Namespace
2524metadata :
2625 name : federate-cmo
2726` ` `
2827
28+ Or run
2929
30- ### Deploy Monitoring Stack
30+ ` ` ` sh
31+ kubectl apply -f docs/user-guides/federation/manifests/00-ns.yaml
32+ ```
3133
34+ ### Deploy Monitoring Stack
3235
3336Apply the following MonitoringStack
3437
6063 memory : 1Gi
6164` ` `
6265
66+ Or run
67+
68+ ` ` ` sh
69+ kubectl apply -f docs/user-guides/federation/manifests/10-ms.yaml
70+ ```
6371
6472### Grant Permission to Federate In-Cluster Prometheus
6573
@@ -84,6 +92,12 @@ subjects:
8492 namespace : federate-cmo
8593` ` `
8694
95+ Or run
96+
97+ ` ` ` sh
98+ kubectl apply -f docs/user-guides/federation/manifests/11-crb.yaml
99+ ```
100+
87101### Create ServiceMonitor for Federation
88102
89103``` yaml
@@ -143,15 +157,27 @@ spec:
143157 name : openshift-service-ca.crt
144158` ` `
145159
160+ Or run
161+
162+ ` ` ` sh
163+ kubectl apply -f docs/user-guides/federation/manifests/20-smon-cmo.yaml
164+ ```
165+
146166## Validation
147167
148- Verify if the setup works by using either the Prometheus UI or by inspecting
149- ` <prometheus>/api/v1/targets`
168+ Verify that the MonitoringStack resource is available:
169+
170+ ``` sh
171+ kubectl wait --for=condition=Available -n federate-cmo --timeout=10s monitoringstacks federate-cmo-ms
172+ ```
173+
174+ You can verify if the setup works by using either the Prometheus UI or by inspecting
175+ ` <prometheus>/api/v1/targets ` .
150176
151177### Prometheus UI
152178
153179Access Prometheus UI by port-forwarding the ` federate-cmo-ms-prometheus `
154- service created by ObO as follows
180+ service created by the Observability Operator as follows
155181
156182``` sh
157183kubectl port-forward svc/federate-cmo-ms-prometheus 9090:9090 --address 0.0.0.0 -n federate-cmo
@@ -165,16 +191,17 @@ Run the following command to inspects all active targets for `federate-cmo-smon`
165191service
166192
167193``` sh
168- kubectl exec -it sts/prometheus-federate-cmo-ms -- \
169- wget -O- -q 'http://localhost:9090/api/v1/targets?state=active' |
170- jq '.data.activeTargets[]| select(.scrapePool | contains("federate-cmo-smon"))| .labels'
194+ kubectl exec -n federate-cmo - it sts/prometheus-federate-cmo-ms -- \
195+ curl -s ' http://localhost:9090/api/v1/targets?state=active' |
196+ jq ' .data.activeTargets[]| select(.scrapePool | contains("federate-cmo-smon"))| .labels'
171197```
172198
173- The above should return the following json
199+ The above should return the following JSON:
174200
175201``` json
176202{
177203 "instance" : " prometheus-k8s.openshift-monitoring.svc:9091" ,
178204 "job" : " federate-cmo-ms-prometheus" ,
179205 "source" : " my-openshift-cluster"
180206}
207+ ```
0 commit comments