This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.3.7. Using tolerations to control cluster logging pod placement
You can use taints and tolerations to ensure that cluster logging pods run on specific nodes and that no other workload can run on those nodes.
Taints and tolerations are simple key:value pair. A taint on a node instructs the node to repel all pods that do not tolerate the taint.
The key is any string, up to 253 characters and the value is any string up to 63 characters. The string must begin with a letter or number, and may contain letters, numbers, hyphens, dots, and underscores.
Sample cluster logging CR with tolerations
You can control which nodes the log store pods runs on and prevent other workloads from using those nodes by using tolerations on the pods.
You apply tolerations to the log store 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 the log store pods can run on that node.
By default, the log store pods have the following toleration:
tolerations: - effect: "NoExecute" key: "node.kubernetes.io/disk-pressure" operator: "Exists"
tolerations:
- effect: "NoExecute"
key: "node.kubernetes.io/disk-pressure"
operator: "Exists"
Prerequisites
- Cluster logging and Elasticsearch must be installed.
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 <node-name> <key>=<value>:<effect>Copy to Clipboard Copied! Toggle word wrap Toggle overflow For example:
oc adm taint nodes node1 elasticsearch=node:NoExecute
$ oc adm taint nodes node1 elasticsearch=node:NoExecuteCopy to Clipboard Copied! Toggle word wrap Toggle overflow This example places a taint on
node1that has keyelasticsearch, valuenode, and taint effectNoExecute. Nodes with theNoExecuteeffect schedule only pods that match the taint and remove existing pods that do not match.Edit the
logstoresection of theClusterLoggingCR to configure a toleration for the Elasticsearch pods:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Specify the key that you added to the node.
- 2
- Specify the
Existsoperator to require a taint with the keyelasticsearchto be present on the Node. - 3
- Specify the
NoExecuteeffect. - 4
- Optionally, specify the
tolerationSecondsparameter 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.
You can control the node where the log visualizer pod runs and prevent other workloads from using those nodes by using tolerations on the pods.
You apply tolerations to the log visualizer pod 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 the Kibana pod can run on that node.
Prerequisites
- Cluster logging and Elasticsearch must be installed.
Procedure
Use the following command to add a taint to a node where you want to schedule the log visualizer pod:
oc adm taint nodes <node-name> <key>=<value>:<effect>
$ oc adm taint nodes <node-name> <key>=<value>:<effect>Copy to Clipboard Copied! Toggle word wrap Toggle overflow For example:
oc adm taint nodes node1 kibana=node:NoExecute
$ oc adm taint nodes node1 kibana=node:NoExecuteCopy to Clipboard Copied! Toggle word wrap Toggle overflow This example places a taint on
node1that has keykibana, valuenode, and taint effectNoExecute. You must use theNoExecutetaint effect.NoExecuteschedules only pods that match the taint and remove existing pods that do not match.Edit the
visualizationsection of theClusterLoggingCR to configure a toleration for the Kibana pod:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
This toleration matches the taint created by the oc adm taint command. A pod with this toleration would be able to schedule onto node1.
You can ensure which nodes the logging collector pods run on and prevent other workloads from using those nodes by using tolerations on the pods.
You apply tolerations to logging collector pods through the ClusterLogging custom resource (CR) and apply taints to a node through the node specification. You can use taints and tolerations to ensure the pod does not get evicted for things like memory and CPU issues.
By default, the logging collector pods have the following toleration:
tolerations: - key: "node-role.kubernetes.io/master" operator: "Exists" effect: "NoExecute"
tolerations:
- key: "node-role.kubernetes.io/master"
operator: "Exists"
effect: "NoExecute"
Prerequisites
- Cluster logging and Elasticsearch must be installed.
Procedure
Use the following command to add a taint to a node where you want logging collector pods to schedule logging collector pods:
oc adm taint nodes <node-name> <key>=<value>:<effect>
$ oc adm taint nodes <node-name> <key>=<value>:<effect>Copy to Clipboard Copied! Toggle word wrap Toggle overflow For example:
oc adm taint nodes node1 collector=node:NoExecute
$ oc adm taint nodes node1 collector=node:NoExecuteCopy to Clipboard Copied! Toggle word wrap Toggle overflow This example places a taint on
node1that has keycollector, valuenode, and taint effectNoExecute. You must use theNoExecutetaint effect.NoExecuteschedules only pods that match the taint and removes existing pods that do not match.Edit the
collectionstanza of theClusterLoggingcustom resource (CR) to configure a toleration for the logging collector pods:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
This toleration matches the taint created by the oc adm taint command. A pod with this toleration would be able to schedule onto node1.
3.7.4. Additional resources 复制链接链接已复制到粘贴板!
For more information about taints and tolerations, see Controlling pod placement using node taints.