You can control which nodes the Elasticsearch pods runs on and prevent
other workloads from using those nodes by using tolerations on the pods.
You apply tolerations to Elasticsearch pods through the Clusterlogging
custom resource (CR)
and apply taints to a node through the node specification. A taint on a node is a key:value pair
that
instructs the node to repel all pods that do not tolerate the taint. Using a specific key:value
pair
that is not on other pods ensures only Elasticsearch pods can run on that node.
By default, the Elasticsearch pods have the following toleration:
tolerations:
- effect: "NoExecute"
key: "node.kubernetes.io/disk-pressure"
operator: "Exists"
Procedure
-
Use the following command to add a taint to a node where you want to schedule the cluster logging pods:
$ oc adm taint nodes <node-name> <key>=<value>:<effect>
$ oc adm taint nodes node1 elasticsearch=node:NoExecute
This example places a taint on node1
that has key elasticsearch
, value node
, and taint effect NoExecute
.
Nodes with the NoExecute
effect schedule only pods that match the taint and remove existing pods
that do not match.
-
Edit the logstore
section of the Clusterlogging
custom resource (CR) to configure a toleration for the Elasticsearch pods:
logStore:
type: "elasticsearch"
elasticsearch:
nodeCount: 1
tolerations:
- key: "elasticsearch" (1)
operator: "Exists" (2)
effect: "NoExecute" (3)
tolerationSeconds: 6000 (4)
1 |
Specify the key that you added to the node. |
2 |
Specify the Exists operator to require a taint with the key elasticsearch to be present on the Node. |
3 |
Specify the NoExecute effect. |
4 |
Optionally, specify the tolerationSeconds parameter to set how long a pod can remain bound to a node before being evicted. |
This toleration matches the taint created by the oc adm taint
command. A pod with this toleration could be scheduled onto node1
.