Skip to content

Commit 3fe9227

Browse files
authored
Merge pull request #59703 from xenolinux/metrics-monitoring-cert-manager-operator
OSDOCS#6016: cert-manager: Enabling metrics and monitoring
2 parents d0376ea + 18dbc75 commit 3fe9227

File tree

4 files changed

+120
-0
lines changed

4 files changed

+120
-0
lines changed

_topic_maps/_topic_map.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,8 @@ Topics:
10111011
File: cert-manager-operator-install
10121012
- Name: Managing certificates with an ACME issuer
10131013
File: cert-manager-operator-issuer-acme
1014+
- Name: Enabling monitoring for the cert-manager Operator for Red Hat OpenShift
1015+
File: cert-manager-monitoring
10141016
- Name: Configuring the egress proxy for the cert-manager Operator for Red Hat OpenShift
10151017
File: cert-manager-operator-proxy
10161018
- Name: Uninstalling the cert-manager Operator for Red Hat OpenShift
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * security/cert_manager_operator/cert-manager-monitoring.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="cert-manager-enable-metrics_{context}"]
7+
= Enabling monitoring by using a service monitor for the {cert-manager-operator}
8+
9+
You can enable monitoring and metrics collection for the {cert-manager-operator} by using a service monitor to perform the custom metrics scraping.
10+
11+
.Prerequisites
12+
13+
* You have access to the cluster with `cluster-admin` privileges.
14+
* The {cert-manager-operator} is installed.
15+
16+
.Procedure
17+
18+
. Add the label to enable cluster monitoring by running the following command:
19+
+
20+
[source,terminal]
21+
----
22+
$ oc label namespace cert-manager openshift.io/cluster-monitoring=true
23+
----
24+
25+
. Enable monitoring for user-defined projects. See _Enabling monitoring for user-defined projects_ for instructions.
26+
27+
. Create a service monitor:
28+
29+
.. Create a YAML file that defines the `ServiceMonitor` object:
30+
+
31+
.Example `service-monitor.yaml` file
32+
[source,yaml]
33+
----
34+
apiVersion: monitoring.coreos.com/v1
35+
kind: ServiceMonitor
36+
metadata:
37+
labels:
38+
app: cert-manager
39+
app.kubernetes.io/component: controller
40+
app.kubernetes.io/instance: cert-manager
41+
app.kubernetes.io/name: cert-manager
42+
name: cert-manager
43+
namespace: cert-manager
44+
spec:
45+
endpoints:
46+
- interval: 30s
47+
port: tcp-prometheus-servicemonitor
48+
scheme: http
49+
selector:
50+
matchLabels:
51+
app.kubernetes.io/component: controller
52+
app.kubernetes.io/instance: cert-manager
53+
app.kubernetes.io/name: cert-manager
54+
----
55+
56+
.. Create the `ServiceMonitor` object by running the following command:
57+
+
58+
[source,terminal]
59+
----
60+
$ oc create -f service-monitor.yaml
61+
----
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * security/cert_manager_operator/cert-manager-monitoring.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="cert-manager-query-metrics_{context}"]
7+
= Querying metrics for the {cert-manager-operator}
8+
9+
After you have enabled monitoring for the {cert-manager-operator}, you can query its metrics by using the {product-title} web console.
10+
11+
.Prerequisites
12+
13+
* You have access to the cluster as a user with the `cluster-admin` role.
14+
* You have installed the {cert-manager-operator}.
15+
* You have enabled monitoring and metrics collection for the {cert-manager-operator}.
16+
17+
.Procedure
18+
19+
. From the {product-title} web console, navigate to *Observe* -> *Metrics*.
20+
21+
. Add a query by using one of the following formats:
22+
23+
** Specify the endpoints:
24+
+
25+
[source,promql]
26+
----
27+
{instance="<endpoint>"} <1>
28+
----
29+
<1> Replace `<endpoint>` with the value of the endpoint for the `cert-manager` service. You can find the endpoint value by running the following command: `oc describe service cert-manager -n cert-manager`.
30+
31+
** Specify the `tcp-prometheus-servicemonitor` port:
32+
+
33+
[source,promql]
34+
----
35+
{endpoint="tcp-prometheus-servicemonitor"}
36+
----
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
:_content-type: ASSEMBLY
2+
[id="cert-manager-monitoring"]
3+
= Enabling monitoring for the {cert-manager-operator}
4+
include::_attributes/common-attributes.adoc[]
5+
:context: cert-manager-monitoring
6+
7+
toc::[]
8+
9+
You can expose controller metrics for the {cert-manager-operator} in the format provided by the Prometheus Operator.
10+
11+
// Enabling metrics for the {cert-manager-operator}
12+
include::modules/cert-manager-enable-metrics.adoc[leveloffset=+1]
13+
14+
[role="_additional-resources"]
15+
.Additional resources
16+
17+
* xref:../../monitoring/enabling-monitoring-for-user-defined-projects.adoc#enabling-monitoring-for-user-defined-projects_enabling-monitoring-for-user-defined-projects[Enabling monitoring for user-defined projects]
18+
* xref:../../monitoring/managing-metrics.adoc#setting-up-metrics-collection-for-user-defined-projects_managing-metrics[Setting up metrics collection for user-defined projects]
19+
20+
// Querying metrics for the {cert-manager-operator}
21+
include::modules/cert-manager-query-metrics.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)