concept toleration in category kubernetes

appears as: Tolerations, toleration, toleration, tolerations
Core Kubernetes

This is an excerpt from Manning's book Core Kubernetes.

Taints and Tolerations

Taints disallow specific Pods from running on a particular Node and are complemented by Tolerations, which enable a Pod to run on tainted Nodes.

Part of scheduling Pods to run on Nodes involves making sure individual Pods don’t run on specific Nodes. The scheduler takes into consideration taints and tolerations to ensure that Pods do not get scheduled to Nodes that are not appropriate for the Pod to operates on. For instance, regular workload Pods, such as your Nginx app, should not be scheduled to the Nodes that are part of the control plane. The control plane Nodes are tainted, and regular workload Pods are not deployed to those Nodes. Tolerations are added to the API definition of a Pod, allowing the scheduling of Pods to the control plane. Various controllers such as CNI providers need to be scheduled on every Node, including Nodes that comprise the control plane.

Nodes support a concept of tainting, which directly defines a Node as being married to a specific type of Pod, as specified by toleration. An example follows with tainted Pod.

Kubernetes in Action

This is an excerpt from Manning's book Kubernetes in Action.

  • Does the pod tolerate the taints of the node? Taints and tolerations are explained in chapter 16.
  • Disregard the equal sign, which is shown in the pod’s tolerations, but not in the node’s taints. Kubectl apparently displays taints and tolerations differently when the taint’s/toleration’s value is null.

    Listing 16.4. A production Deployment with a toleration: production-deployment.yaml
    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
      name: prod
    spec:
      replicas: 5
      template:
        spec:
          ...
          tolerations:
          - key: node-type         #1
            operator: Equal        #1
            value: production      #1
            effect: NoSchedule     #1

    16.1.4. Understanding what taints and tolerations can be used for

    Nodes can have more than one taint and pods can have more than one toleration. As you’ve seen, taints can only have a key and an effect and don’t require a value. Tolerations can tolerate a specific value by specifying the Equal operator (that’s also the default operator if you don’t specify one), or they can tolerate any value for a specific taint key if you use the Exists operator.