Skip to content

Commit 02e8c7d

Browse files
committed
Add Kiali Configuration for user-workload-monitoring.
1 parent 20f196e commit 02e8c7d

File tree

1 file changed

+77
-6
lines changed

1 file changed

+77
-6
lines changed

modules/ossm-integrating-with-user-workload-monitoring.adoc

Lines changed: 77 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,60 @@ The following steps show how to integrate Service Mesh with user-workload monito
1515

1616
* User-workload monitoring is enabled.
1717
* {SMProductName} Operator 2.4 is installed.
18+
* Kiali Operator 1.65 is installed.
1819
1920
.Procedure
2021

22+
. Create a token to Thanos for Kiali by running the following commands:
23+
+
24+
.. Set the `SECRET` environment variable by running the following command:
25+
+
26+
[source,terminal]
27+
----
28+
$ SECRET=`oc get secret -n openshift-user-workload-monitoring |
29+
grep prometheus-user-workload-token | head -n 1 | awk '{print $1 }'`
30+
----
31+
+
32+
.. Set the `TOKEN` environment variable by running the following command:
33+
+
34+
[source,terminal]
35+
----
36+
$ TOKEN=`echo $(oc get secret $SECRET -n openshift-user-workload-monitoring -o jsonpath='{.data.token}' | base64 -d`
37+
----
38+
+
39+
.. Create a token to Thanos for Kiali by running the following command:
40+
+
41+
[source,terminal]
42+
----
43+
$ oc create secret generic thanos-querier-web-token -n istio-system --from-literal=token=$TOKEN
44+
----
45+
46+
. Configure Kiali for user-workload monitoring:
47+
+
48+
[source,yaml]
49+
----
50+
apiVersion: kiali.io/v1alpha1
51+
kind: Kiali
52+
metadata:
53+
name: kiali-user-workload-monitoring
54+
namespace: istio-system
55+
spec:
56+
external_services:
57+
istio:
58+
url_service_version: 'http://istiod-basic.istio-system:15014/version'
59+
prometheus:
60+
auth:
61+
token: secret:thanos-querier-web-token:token
62+
type: bearer
63+
use_kiali_token: false
64+
query_scope:
65+
mesh_id: "basic-istio-system"
66+
thanos_proxy:
67+
enabled: true
68+
url: https://thanos-querier.openshift-monitoring.svc.cluster.local:9091
69+
version: v1.65
70+
----
71+
2172
. Configure the SMCP for external Prometheus:
2273
+
2374
[source,yaml]
@@ -34,7 +85,12 @@ spec:
3485
grafana:
3586
enabled: false # <2>
3687
kiali:
37-
enabled: false
88+
name: kiali-user-workload-monitoring
89+
spec:
90+
meshConfig:
91+
extenstionProviders:
92+
- name: prometheus
93+
prometheus: {}
3894
----
3995
<1> Disable the default Prometheus instance provided by OSSM.
4096
<2> Disable Grafana. It is not supported with an external Prometheus instance.
@@ -47,7 +103,7 @@ apiVersion: networking.k8s.io/v1
47103
kind: NetworkPolicy
48104
metadata:
49105
name: user-workload-access
50-
namespace: bookinfo
106+
namespace: bookinfo # <1>
51107
spec:
52108
ingress:
53109
- from:
@@ -58,6 +114,7 @@ spec:
58114
policyTypes:
59115
- Ingress
60116
----
117+
<1> The custom network policy must be applied to all namespaces.
61118

62119
. Apply a `Telemetry` object to enable traffic metrics in Istio proxies:
63120
+
@@ -99,11 +156,18 @@ spec:
99156
interval: 30s
100157
relabelings:
101158
- action: replace
102-
replacement: "<smcp_name>-<smcp_namespace>" # <2>
159+
replacement: "basic-istio-system" # <2>
103160
targetLabel: mesh_id
104161
----
105162
<1> Since {product-title} monitoring ignores the `namespaceSelector` spec in `ServiceMonitor` and `PodMonitor` objects, you must apply the `PodMonitor` object in all mesh namespaces, including the control plane namespace.
106-
<2> A shared Prometheus instance can include metrics from multiple meshes. However, if you are deploying Kiali, the metrics must be associated with a single mesh. To associate metrics with a single mesh, add a unique `mesh_id` to each one. Doing so narrows the query scope in Kiali to only the relevant mesh metrics.
163+
<2> The string `"basic-istio-system"` is a combination of the SMCP name and its namespace, but any label can be used as long as it is unique for every mesh using user workload monitoring in the cluster. The `spec.prometheus.query_scope` of the Kiali resource configured in Step 2 needs to match this value.
164+
+
165+
[NOTE]
166+
====
167+
If there is only one mesh using user-workload monitoring, then both the `mesh_id` relabeling and the `spec.prometheus.query_scope` field in the Kiali resource are optional (but the `query_scope` field given here should be removed if the `mesh_id` label is removed).
168+
169+
If there might be multiple meshes using user-workload monitoring, then both the `mesh_id` relabelings and the `spec.prometheus.query_scope` field in the Kiali resource are required so that Kiali only sees metrics from its associated mesh. If Kiali is not being deployed, applying the `mesh_id` relabeling is still recommended so that metrics from different meshes can be distinguished from one another.
170+
====
107171

108172
. Apply a `PodMonitor` object to collect metrics from Istio proxies:
109173
+
@@ -149,10 +213,17 @@ spec:
149213
action: replace
150214
targetLabel: pod_name
151215
- action: replace
152-
replacement: "<smcp_name>-<smcp_namespace>" # <2>
216+
replacement: "basic-istio-system" # <2>
153217
targetLabel: mesh_id
154218
----
155219
<1> Since {product-title} monitoring ignores the `namespaceSelector` spec in `ServiceMonitor` and `PodMonitor` objects, you must apply the `PodMonitor` object in all mesh namespaces, including the control plane namespace.
156-
<2> A shared Prometheus instance can include metrics from multiple meshes. However, if you are deploying Kiali, the metrics must be associated with a single mesh. To associate metrics with a single mesh, add a unique `mesh_id` to each one. Doing so narrows the query scope in Kiali to only the relevant mesh metrics.
220+
<2> The string `"basic-istio-system"` is a combination of the SMCP name and its namespace, but any label can be used as long as it is unique for every mesh using user workload monitoring in the cluster. The `spec.prometheus.query_scope` of the Kiali resource configured in Step 2 needs to match this value.
221+
+
222+
[NOTE]
223+
====
224+
If there is only one mesh using user-workload monitoring, then both the `mesh_id` relabeling and the `spec.prometheus.query_scope` field in the Kiali resource are optional (but the `query_scope` field given here should be removed if the `mesh_id` label is removed).
225+
226+
If there might be multiple meshes using user-workload monitoring, then both the `mesh_id` relabelings and the `spec.prometheus.query_scope` field in the Kiali resource are required so that Kiali only sees metrics from its associated mesh. If Kiali is not being deployed, applying the `mesh_id` relabeling is still recommended so that metrics from different meshes can be distinguished from one another.
227+
====
157228
158229
. Open the {product-title} web console, and check that metrics are visible.

0 commit comments

Comments
 (0)