mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
94 lines
2.7 KiB
Plaintext
94 lines
2.7 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * security/cert_manager_operator/cert-manager-monitoring.adoc
|
|
|
|
:_mod-docs-content-type: PROCEDURE
|
|
[id="cert-manager-enable-metrics_{context}"]
|
|
= Configuring metrics collection for {cert-manager-operator} operands by using a ServiceMonitor
|
|
|
|
[role="_abstract"]]
|
|
The {cert-manager-operator} operands expose metrics by default on port `9402` at the `/metrics` service endpoint. You can configure metrics collection for the cert-manager operands by creating a `ServiceMonitor` custom resource (CR) that enables Prometheus Operator to collect custom metrics. For more information, see "Configuring user workload monitoring".
|
|
|
|
.Prerequisites
|
|
|
|
* You have access to the cluster as a user with the `cluster-admin` role.
|
|
* You have installed the {cert-manager-operator}.
|
|
* You have enabled the user workload monitoring.
|
|
|
|
.Procedure
|
|
|
|
. Create the `ServiceMonitor` CR:
|
|
|
|
.. Create the YAML file that defines the `ServiceMonitor` CR:
|
|
+
|
|
.Example `servicemonitor-cert-manager.yaml` file
|
|
[source,yaml]
|
|
----
|
|
apiVersion: monitoring.coreos.com/v1
|
|
kind: ServiceMonitor
|
|
metadata:
|
|
labels:
|
|
app: cert-manager
|
|
app.kubernetes.io/instance: cert-manager
|
|
app.kubernetes.io/name: cert-manager
|
|
name: cert-manager
|
|
namespace: cert-manager
|
|
spec:
|
|
endpoints:
|
|
- honorLabels: false
|
|
interval: 60s
|
|
path: /metrics
|
|
scrapeTimeout: 30s
|
|
targetPort: 9402
|
|
selector:
|
|
matchExpressions:
|
|
- key: app.kubernetes.io/name
|
|
operator: In
|
|
values:
|
|
- cainjector
|
|
- cert-manager
|
|
- webhook
|
|
- key: app.kubernetes.io/instance
|
|
operator: In
|
|
values:
|
|
- cert-manager
|
|
- key: app.kubernetes.io/component
|
|
operator: In
|
|
values:
|
|
- cainjector
|
|
- controller
|
|
- webhook
|
|
----
|
|
|
|
.. Create the `ServiceMonitor` CR by running the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc apply -f servicemonitor-cert-manager.yaml
|
|
----
|
|
+
|
|
After the `ServiceMonitor` CR is created, the user workload Prometheus instance begins metrics collection from the {cert-manager-operator} operands. The collected metrics are labeled with `job="cert-manager"`,`job="cert-manager-cainjector"`, and `job="cert-manager-webhook"`.
|
|
|
|
.Verification
|
|
|
|
. In the {product-title} web console, navigate to *Observe* → *Targets*.
|
|
|
|
. In the *Label* filter field, enter the following labels to filter the metrics targets for each operand:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ service=cert-manager
|
|
----
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ service=cert-manager-webhook
|
|
----
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ service=cert-manager-cainjector
|
|
----
|
|
|
|
. Confirm that the *Status* column shows `Up` for the `cert-manager`, `cert-manager-webhook`, and `cert-manager-cainjector` entries.
|