Configuring metrics collection for the istio-csr operand
The istio-csr operand exposes metrics by default on port 9402 at the /metrics service endpoint. You can configure metrics collection for the operand by creating a ServiceMonitor custom resource (CR), which enables the Prometheus Operator to collect custom metrics. For more information, see "Configuring user workload monitoring".
-
You have access to the cluster with
cluster-adminprivileges. -
You have installed the cert-manager Operator for Red Hat OpenShift.
-
You have enabled user workload monitoring.
-
Create the
ServiceMonitorCR definition file:Exampleservicemonitor-istio-csr.yamlfileapiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: labels: app: cert-manager-istio-csr app.kubernetes.io/instance: cert-manager-istio-csr app.kubernetes.io/name: cert-manager-istio-csr name: cert-manager-istio-csr namespace: <istio_csr_project_name> spec: endpoints: - honorLabels: false interval: 60s path: /metrics scrapeTimeout: 30s targetPort: 9402 namespaceSelector: matchNames: - <istio_csr_project_name> selector: matchLabels: app: cert-manager-istio-csr app.kubernetes.io/instance: cert-manager-istio-csr app.kubernetes.io/name: cert-manager-istio-csrReplace
<istio_csr_project_name>with the namespace where you created theIstioCSRCR. -
Create the
ServiceMonitorCR by running the following command:$ oc apply -f servicemonitor-istio-csr.yamlAfter the
ServiceMonitorCR is created, the user workload Prometheus instance starts collecting metrics from the istio-csr operand. The collected metrics are labeled withjob="cert-manager-istio-csr".
-
Log in to the Red Hat OpenShift Container Platform web console.
-
Click Observe → Targets.
-
In the Label filter field, enter the
service=cert-manager-istio-csrlabel to filter the metrics targets. -
Confirm that the Status column shows Up for the
cert-manager-istio-csrtarget.