You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can move any of the monitoring stack components to specific nodes.
9
+
To specify the nodes in your cluster on which monitoring stack components will run, configure the `nodeSelector` constraint in the component's `ConfigMap` object to match labels assigned to the nodes.
10
+
11
+
[NOTE]
12
+
====
13
+
You cannot add a node selector constraint directly to an existing scheduled pod.
14
+
====
10
15
11
16
.Prerequisites
12
17
13
18
* *If you are configuring core {product-title} monitoring components*:
14
19
** You have access to the cluster as a user with the `cluster-admin` role.
15
20
** You have created the `cluster-monitoring-config``ConfigMap` object.
16
21
* *If you are configuring components that monitor user-defined projects*:
17
-
** You have access to the cluster as a user with the `cluster-admin` role, or as a user with the `user-workload-monitoring-config-edit` role in the `openshift-user-workload-monitoring` project.
22
+
** You have access to the cluster as a user with the `cluster-admin` role or as a user with the `user-workload-monitoring-config-edit` role in the `openshift-user-workload-monitoring` project.
18
23
** You have created the `user-workload-monitoring-config``ConfigMap` object.
19
24
* You have installed the OpenShift CLI (`oc`).
20
25
21
26
.Procedure
22
27
28
+
. If you have not done so yet, add a label to the nodes on which you want to run the monitoring components:
29
+
+
30
+
[source,terminal]
31
+
----
32
+
$ oc label nodes <node-name> <node-label>
33
+
----
23
34
. Edit the `ConfigMap` object:
24
35
***To move a component that monitors core {product-title} projects*:
36
+
25
37
.. Edit the `cluster-monitoring-config` `ConfigMap` object in the `openshift-monitoring` project:
.. Specify the `nodeSelector` constraint for the component under `data/config.yaml`:
44
+
.. Specify the node labels for the `nodeSelector` constraint for the component under `data/config.yaml`:
33
45
+
34
46
[source,yaml]
35
47
----
@@ -40,77 +52,32 @@ metadata:
40
52
namespace: openshift-monitoring
41
53
data:
42
54
config.yaml: |
43
-
<component>:
55
+
<component>: <1>
44
56
nodeSelector:
45
-
<node_key>: <node_value>
46
-
<node_key>: <node_value>
57
+
<node-label-1> <2>
58
+
<node-label-2> <3>
47
59
<...>
48
60
----
49
-
+
50
-
Substitute `<component>` accordingly and substitute `<node_key>: <node_value>` with the map of key-value pairs that specifies a group of destination nodes. Often, only a single key-value pair is used.
51
-
+
52
-
The component can only run on nodes that have each of the specified key-value pairs as labels. The nodes can have additional labels as well.
53
-
+
54
-
[IMPORTANT]
55
-
====
56
-
Many of the monitoring components are deployed by using multiple pods across different nodes in the cluster to maintain high availability. When moving monitoring components to labeled nodes, ensure that enough matching nodes are available to maintain resilience for the component. If only one label is specified, ensure that enough nodes contain that label to distribute all of the pods for the component across separate nodes. Alternatively, you can specify multiple labels each relating to individual nodes.
57
-
====
61
+
<1> Substitute `<component>` with the appropriate monitoring stack component name.
62
+
<2> Substitute `<node-label-1>` with the label you added to the node.
63
+
<3> Optional: Specify additional labels.
64
+
If you specify additional labels, the pods for the component are only scheduled on the nodes that contain all of the specified labels.
58
65
+
59
66
[NOTE]
60
67
====
61
-
If monitoring components remain in a `Pending` state after configuring the `nodeSelector` constraint, check the pod logs for errors relating to taints and tolerations.
68
+
If monitoring components remain in a `Pending` state after configuring the `nodeSelector` constraint, check the pod events for errors relating to taints and tolerations.
62
69
====
63
-
+
64
-
For example, to move monitoring components for core {product-title} projects to specific nodes that are labeled `nodename: controlplane1`, `nodename: worker1`, `nodename: worker2`, and `nodename: worker2`, use:
65
-
+
66
-
[source,yaml,subs=quotes]
67
-
----
68
-
apiVersion: v1
69
-
kind: ConfigMap
70
-
metadata:
71
-
name: cluster-monitoring-config
72
-
namespace: openshift-monitoring
73
-
data:
74
-
config.yaml: |
75
-
prometheusOperator:
76
-
nodeSelector:
77
-
nodename: controlplane1
78
-
prometheusK8s:
79
-
nodeSelector:
80
-
nodename: worker1
81
-
nodename: worker2
82
-
alertmanagerMain:
83
-
nodeSelector:
84
-
nodename: worker1
85
-
nodename: worker2
86
-
kubeStateMetrics:
87
-
nodeSelector:
88
-
nodename: worker1
89
-
telemeterClient:
90
-
nodeSelector:
91
-
nodename: worker1
92
-
k8sPrometheusAdapter:
93
-
nodeSelector:
94
-
nodename: worker1
95
-
nodename: worker2
96
-
openshiftStateMetrics:
97
-
nodeSelector:
98
-
nodename: worker1
99
-
thanosQuerier:
100
-
nodeSelector:
101
-
nodename: worker1
102
-
nodename: worker2
103
-
----
104
70
105
71
***To move a component that monitors user-defined projects*:
72
+
106
73
.. Edit the `user-workload-monitoring-config` `ConfigMap` object in the `openshift-user-workload-monitoring` project:
.. Specify the `nodeSelector` constraint for the component under `data/config.yaml`:
80
+
.. Specify the node labels for the `nodeSelector` constraint for the component under `data/config.yaml`:
114
81
+
115
82
[source,yaml]
116
83
----
@@ -121,52 +88,24 @@ metadata:
121
88
namespace: openshift-user-workload-monitoring
122
89
data:
123
90
config.yaml: |
124
-
<component>:
91
+
<component>: <1>
125
92
nodeSelector:
126
-
<node_key>: <node_value>
127
-
<node_key>: <node_value>
93
+
<node-label-1> <2>
94
+
<node-label-2> <3>
128
95
<...>
129
96
----
130
-
+
131
-
Substitute `<component>` accordingly and substitute `<node_key>: <node_value>` with the map of key-value pairs that specifies the destination nodes. Often, only a single key-value pair is used.
132
-
+
133
-
The component can only run on nodes that have each of the specified key-value pairs as labels. The nodes can have additional labels as well.
134
-
+
135
-
[IMPORTANT]
136
-
====
137
-
Many of the monitoring components are deployed by using multiple pods across different nodes in the cluster to maintain high availability. When moving monitoring components to labeled nodes, ensure that enough matching nodes are available to maintain resilience for the component. If only one label is specified, ensure that enough nodes contain that label to distribute all of the pods for the component across separate nodes. Alternatively, you can specify multiple labels each relating to individual nodes.
138
-
====
97
+
<1> Substitute `<component>` with the appropriate monitoring stack component name.
98
+
<2> Substitute `<node-label-1>` with the label you added to the node.
99
+
<3> Optional: Specify additional labels.
100
+
If you specify additional labels, the pods for the component are only scheduled on the nodes that contain all of the specified labels.
139
101
+
140
102
[NOTE]
141
103
====
142
-
If monitoring components remain in a `Pending` state after configuring the `nodeSelector` constraint, check the pod logs for errors relating to taints and tolerations.
104
+
If monitoring components remain in a `Pending` state after configuring the `nodeSelector` constraint, check the pod events for errors relating to taints and tolerations.
143
105
====
144
-
+
145
-
For example, to move monitoring components for user-defined projects to specific worker nodes labeled `nodename: worker1`, `nodename: worker2`, and `nodename: worker2`, use:
146
-
+
147
-
[source,yaml,subs=quotes]
148
-
----
149
-
apiVersion: v1
150
-
kind: ConfigMap
151
-
metadata:
152
-
name: user-workload-monitoring-config
153
-
namespace: openshift-user-workload-monitoring
154
-
data:
155
-
config.yaml: |
156
-
prometheusOperator:
157
-
nodeSelector:
158
-
nodename: worker1
159
-
prometheus:
160
-
nodeSelector:
161
-
nodename: worker1
162
-
nodename: worker2
163
-
thanosRuler:
164
-
nodeSelector:
165
-
nodename: worker1
166
-
nodename: worker2
167
-
----
168
106
169
-
. Save the file to apply the changes. The components affected by the new configuration are moved to the new nodes automatically.
107
+
. Save the file to apply the changes.
108
+
The components specified in the new configuration are moved to the new nodes automatically.
170
109
+
171
110
[NOTE]
172
111
====
@@ -175,5 +114,6 @@ Configurations applied to the `user-workload-monitoring-config` `ConfigMap` obje
175
114
+
176
115
[WARNING]
177
116
====
178
-
When changes are saved to a monitoring config map, the pods and other resources in the related project might be redeployed. The running monitoring processes in that project might also be restarted.
117
+
When you save changes to a monitoring config map, the pods and other resources in the project might be redeployed.
118
+
The running monitoring processes in that project might also restart.
= Using node selectors to move monitoring components
8
+
9
+
By using the `nodeSelector` constraint with labeled nodes, you can move any of the monitoring stack components to specific nodes.
10
+
By doing so, you can control the placement and distribution of the monitoring components across a cluster.
11
+
12
+
By controlling placement and distribution of monitoring components, you can optimize system resource use, improve performance, and segregate workloads based on specific requirements or policies.
If you move monitoring components by using node selector constraints, be aware that other constraints to control pod scheduling might exist for a cluster:
19
+
20
+
* Topology spread constraints might be in place to control pod placement.
21
+
* Hard anti-affinity rules are in place for Prometheus, Thanos Querier, Alertmanager, and other monitoring components to ensure that multiple pods for these components are always spread across different nodes and are therefore always highly available.
22
+
23
+
When scheduling pods onto nodes, the pod scheduler tries to satisfy all existing constraints when determining pod placement.
24
+
That is, all constraints compound when the pod scheduler determines which pods will be placed on which nodes.
25
+
26
+
Therefore, if you configure a node selector constraint but existing constraints cannot all be satisfied, the pod scheduler cannot match all constraints and will not schedule a pod for placement onto a node.
27
+
28
+
To maintain resilience and high availability for monitoring components, ensure that enough nodes are available and match all constraints when you configure a node selector constraint to move a component.
* xref:../nodes/nodes/nodes-nodes-working.adoc#nodes-nodes-working-updating_nodes-nodes-working[Understanding how to update labels on nodes]
54
+
* xref:../nodes/scheduling/nodes-scheduler-node-selectors.adoc#nodes-scheduler-node-selectors[Placing pods on specific nodes using node selectors]
55
+
* xref:../nodes/scheduling/nodes-scheduler-pod-affinity.adoc[Placing pods relative to other pods using affinity and anti-affinity rules]
56
+
* xref:../nodes/scheduling/nodes-scheduler-pod-topology-spread-constraints.adoc[Controlling pod placement by using pod topology spread constraints]
57
+
* xref:../monitoring/configuring-the-monitoring-stack.adoc#configuring_pod_topology_spread_constraintsfor_monitoring_configuring-the-monitoring-stack[Configuring pod topology spread constraints for monitoring]
58
+
* link:https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector[Kubernetes documentation about node selectors]
* See xref:../monitoring/configuring-the-monitoring-stack.adoc#preparing-to-configure-the-monitoring-stack[Preparing to configure the monitoring stack] for steps to create monitoring config maps
55
67
* xref:../monitoring/enabling-monitoring-for-user-defined-projects.adoc#enabling-monitoring-for-user-defined-projects[Enabling monitoring for user-defined projects]
56
-
* xref:../nodes/nodes/nodes-nodes-working.adoc#nodes-nodes-working-updating_nodes-nodes-working[Understanding how to update labels on nodes]
57
-
* xref:../nodes/scheduling/nodes-scheduler-node-selectors.adoc#nodes-scheduler-node-selectors[Placing pods on specific nodes using node selectors]
58
-
* See the link:https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector[Kubernetes documentation] for details on the `nodeSelector` constraint
* See xref:../monitoring/managing-metrics.adoc#viewing-a-list-of-available-metrics_managing-metrics[Viewing a list of available metrics] for steps to view a list of metrics being collected for a cluster.
127
-
* See xref:../nodes/clusters/nodes-cluster-enabling-features.adoc[Enabling features using feature gates] for steps to enable Technology Preview features.
136
+
* See xref:../nodes/clusters/nodes-cluster-enabling-features.adoc[Enabling features using feature gates] for steps to enable Technology Preview features.
128
137
129
138
// Managing scrape sample limits for user-defined projects
0 commit comments