Using tolerations to control OpenShift Logging pod placement

    Taints and tolerations are simple 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 logging subsystem 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:

    1. tolerations:
    2. - effect: "NoExecute"
    3. key: "node.kubernetes.io/disk-pressure"
    4. operator: "Exists"

    Prerequisites

    • The Red Hat OpenShift Logging and Elasticsearch Operators must be installed.

    Procedure

    1. Use the following command to add a taint to a node where you want to schedule the OpenShift Logging pods:

      1. $ oc adm taint nodes <node-name> <key>=<value>:<effect>

      For example:

      1. $ oc adm taint nodes node1 elasticsearch=node:NoExecute
    2. Edit the logstore section of the ClusterLogging CR to configure a toleration for the Elasticsearch pods:

    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 pair that is not on other pods ensures only the Kibana pod can run on that node.

    Prerequisites

    Procedure

    1. Use the following command to add a taint to a node where you want to schedule the log visualizer pod:

      1. $ oc adm taint nodes <node-name> <key>=<value>:<effect>

      For example:

      1. $ oc adm taint nodes node1 kibana=node:NoExecute

      This example places a taint on node1 that has key kibana, value node, and taint effect NoExecute. You must use the NoExecute taint effect. NoExecute schedules only pods that match the taint and remove existing pods that do not match.

    2. Edit the visualization section of the ClusterLogging CR to configure a toleration for the Kibana pod:

      1. visualization:
      2. type: "kibana"
      3. kibana:
      4. tolerations:
      5. - key: "kibana" (1)
      6. operator: "Exists" (2)
      7. effect: "NoExecute" (3)
      8. tolerationSeconds: 6000 (4)

    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 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:

    Prerequisites

    • The Red Hat OpenShift Logging and Elasticsearch Operators must be installed.

    Procedure

    1. Edit the collection stanza of the ClusterLogging custom resource (CR) to configure a toleration for the logging collector pods:

      1. collection:
      2. logs:
      3. type: "fluentd"
      4. fluentd:
      5. tolerations:
      6. - key: "collector" (1)
      7. operator: "Exists" (2)
      8. effect: "NoExecute" (3)
      9. tolerationSeconds: 6000 (4)

    This toleration matches the taint created by the oc adm taint command. A pod with this toleration would be able to schedule onto .