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 Cluster Logging 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 Elasticseach 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 Cluster Logging 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
.