Search code examples
kubernetesdaemonset

Multiple tolerations in daemonset - Kubernetes


Is it possible to define multiple label and taints for a daemonset (i.e.) so that it can access / deploy in multiple nodes?

 spec:
   tolerations:
     - key: "sample-node","example-node"
       operator: "Equal"
       effect: "NoSchedule"
       value: "true"

Or in a different format? Thanks in advance!


Solution

  • Syntax mentioned in your query will fail with below error

    is invalid: spec.tolerations[0].key: Invalid value: "sample-node,example-node"
    

    The tolerations can be added as below:

    tolerations:
    - key: "sample-node"
      operator: "Equal"
      effect: "NoSchedule"
      value: "true"
    - key: "example-node"
      operator: "Equal"
      effect: "NoSchedule"
      value: "true"
    

    The above can be achieved by tainting multiple nodes with same label instead of two different labels and adding it twice. An single node can have multiple tolerations and more details are explained in k8s documentation.