Skip to content

Commit 33611e1

Browse files
authored
Merge pull request #69270 from bburt-rh/OBSDOCS-573-add-code-sample-to-set-up-limits-and-requests-for-mon-components
OBSDOCS#573: add docs for configuring resource limits and requests for monitoring components
2 parents 35e293e + b91f94a commit 33611e1

3 files changed

+191
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * monitoring/configuring-the-monitoring-stack.adoc
4+
5+
:_mod-docs-content-type: CONCEPT
6+
[id="about-specifying-limits-and-requests-for-monitoring-components_{context}"]
7+
= About specifying limits and requests for monitoring components
8+
9+
You can configure resource limits and request settings for core platform monitoring components and for the components that monitor user-defined projects, including the following components:
10+
11+
* Alertmanager (for core platform monitoring and for user-defined projects)
12+
* kube-state-metrics
13+
* monitoring-plugin
14+
* node-exporter
15+
* openshift-state-metrics
16+
* Prometheus (for core platform monitoring and for user-defined projects)
17+
* Prometheus Adapter
18+
* Prometheus Operator and its admission webhook service
19+
* Telemeter Client
20+
* Thanos Querier
21+
* Thanos Ruler
22+
23+
By defining resource limits, you limit a container's resource usage, which prevents the container from exceeding the specified maximum values for CPU and memory resources.
24+
25+
By defining resource requests, you specify that a container can be scheduled only on a node that has enough CPU and memory resources available to match the requested resources.
26+
27+
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * monitoring/configuring-the-monitoring-stack.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="specifying-limits-and-resource-requests-for-monitoring-components_{context}"]
7+
= Specifying limits and requests for monitoring components
8+
9+
To configure CPU and memory resources, specify values for resource limits and requests in the appropriate `ConfigMap` object for the namespace in which the monitoring component is located:
10+
11+
* The `cluster-monitoring-config` config map in the `openshift-monitoring` namespace for core platform monitoring
12+
* The `user-workload-monitoring-config` config map in the `openshift-user-workload-monitoring` namespace for components that monitor user-defined projects
13+
14+
.Prerequisites
15+
16+
* *If you are configuring core platform monitoring components*:
17+
** You have access to the cluster as a user with the `cluster-admin` cluster role.
18+
** You have created a `ConfigMap` object named `cluster-monitoring-config`.
19+
* *If you are configuring components that monitor user-defined projects*:
20+
** You have access to the cluster as a user with the `cluster-admin` cluster role, or as a user with the `user-workload-monitoring-config-edit` role in the `openshift-user-workload-monitoring` project.
21+
* You have installed the OpenShift CLI (`oc`).
22+
23+
.Procedure
24+
25+
. To configure core platform monitoring components, edit the `cluster-monitoring-config` config map object in the `openshift-monitoring` namespace:
26+
+
27+
[source,terminal]
28+
----
29+
$ oc -n openshift-monitoring edit configmap cluster-monitoring-config
30+
----
31+
32+
. Add values to define resource limits and requests for each core platform monitoring component you want to configure.
33+
+
34+
[IMPORTANT]
35+
====
36+
Make sure that the value set for a limit is always higher than the value set for a request.
37+
Otherwise, an error will occur, and the container will not run.
38+
====
39+
+
40+
.Example
41+
+
42+
[source,yaml]
43+
----
44+
apiVersion: v1
45+
kind: ConfigMap
46+
metadata:
47+
name: cluster-monitoring-config
48+
namespace: openshift-monitoring
49+
data:
50+
config.yaml: |
51+
alertmanagerMain:
52+
resources:
53+
limits:
54+
cpu: 500m
55+
memory: 1Gi
56+
requests:
57+
cpu: 200m
58+
memory: 500Mi
59+
prometheusK8s:
60+
resources:
61+
limits:
62+
cpu: 500m
63+
memory: 3Gi
64+
requests:
65+
cpu: 200m
66+
memory: 500Mi
67+
prometheusOperator:
68+
resources:
69+
limits:
70+
cpu: 500m
71+
memory: 1Gi
72+
requests:
73+
cpu: 200m
74+
memory: 500Mi
75+
k8sPrometheusAdapter:
76+
resources:
77+
limits:
78+
cpu: 500m
79+
memory: 1Gi
80+
requests:
81+
cpu: 200m
82+
memory: 500Mi
83+
kubeStateMetrics:
84+
resources:
85+
limits:
86+
cpu: 500m
87+
memory: 1Gi
88+
requests:
89+
cpu: 200m
90+
memory: 500Mi
91+
telemeterClient:
92+
resources:
93+
limits:
94+
cpu: 500m
95+
memory: 1Gi
96+
requests:
97+
cpu: 200m
98+
memory: 500Mi
99+
openshiftStateMetrics:
100+
resources:
101+
limits:
102+
cpu: 500m
103+
memory: 1Gi
104+
requests:
105+
cpu: 200m
106+
memory: 500Mi
107+
thanosQuerier:
108+
resources:
109+
limits:
110+
cpu: 500m
111+
memory: 1Gi
112+
requests:
113+
cpu: 200m
114+
memory: 500Mi
115+
nodeExporter:
116+
resources:
117+
limits:
118+
cpu: 50m
119+
memory: 150Mi
120+
requests:
121+
cpu: 20m
122+
memory: 50Mi
123+
monitoringPlugin:
124+
resources:
125+
limits:
126+
cpu: 500m
127+
memory: 1Gi
128+
requests:
129+
cpu: 200m
130+
memory: 500Mi
131+
prometheusOperatorAdmissionWebhook:
132+
resources:
133+
limits:
134+
cpu: 50m
135+
memory: 100Mi
136+
requests:
137+
cpu: 20m
138+
memory: 50Mi
139+
----
140+
141+
. Save the file to apply the changes automatically.
142+
+
143+
[IMPORTANT]
144+
====
145+
When you save changes to the `cluster-monitoring-config` config map, the pods and other resources in the `openshift-monitoring` project might be redeployed.
146+
The running monitoring processes in that project might also restart.
147+
====
148+

monitoring/configuring-the-monitoring-stack.adoc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,22 @@ include::modules/monitoring-setting-the-body-size-limit-for-metrics-scraping.ado
119119
* link:https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config[Prometheus scrape configuration documentation]
120120
endif::openshift-dedicated,openshift-rosa[]
121121
122+
// Configuring limits and resource requests for monitoring components
123+
124+
[id="managing-cpu-and-memory-resources-for-monitoring-components"]
125+
== Managing CPU and memory resources for monitoring components
126+
127+
You can ensure that the containers that run monitoring components have enough CPU and memory resources by specifying values for resource limits and requests for those components.
128+
129+
You can configure these limits and requests for core platform monitoring components in the `openshift-monitoring` namespace and for the components that monitor user-defined projects in the `openshift-user-workload-monitoring` namespace.
130+
131+
include::modules/monitoring-about-specifying-limits-and-requests-for-monitoring-components.adoc[leveloffset=+2]
132+
include::modules/monitoring-specifying-limits-and-requests-for-monitoring-components.adoc[leveloffset=+2]
133+
134+
[role="_additional-resources"]
135+
.Additional resources
136+
* link:https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#requests-and-limits[Kubernetes requests and limits documentation]
137+
122138
// Enabling a dedicated service monitor
123139
include::modules/monitoring-configuring-dedicated-service-monitors.adoc[leveloffset=+1]
124140
include::modules/monitoring-enabling-a-dedicated-service-monitor.adoc[leveloffset=+2]

0 commit comments

Comments
 (0)