Kubernetes Taints and Tolerations are scheduling controls that let you keep certain pods off certain nodes unless those pods explicitly accept the node’s taint. A taint marks a node with a restriction. A toleration is added to a pod so Kubernetes may schedule that pod onto a matching tainted node.
Taints and tolerations help you control where workloads can run in a Kubernetes cluster. They are useful when some nodes should be reserved, isolated, or treated differently from the rest of the node pool.
For example, you might taint GPU nodes so regular web services do not land on expensive GPU capacity. Only machine learning pods with the matching toleration should be allowed there.
A taint is applied to a node. It has three main parts:
workload or dedicated.gpu or airflow.A common taint looks like this:
dedicated=gpu:NoSchedule
A pod must define a matching toleration to be considered for scheduling on that node:
tolerations:
- key: "dedicated"
operator: "Equal"
value: "gpu"
effect: "NoSchedule"
The important detail: a toleration allows a pod to run on a tainted node, but it does not force the pod to run there. If you need to attract pods to specific nodes, combine tolerations with node selectors, node affinity, or topology spread constraints.
Kubernetes supports three taint effects:
NoSchedule is the most common effect for dedicated node pools. NoExecute is stronger and is often used for node health conditions or temporary isolation.
Assume you have a node pool for CI jobs. These jobs are CPU-heavy and can disrupt production services if they share the same nodes.
You can taint the CI nodes:
kubectl taint nodes ci-node-1 dedicated=ci:NoSchedule
Then add a matching toleration to the CI runner pods:
tolerations:
- key: "dedicated"
operator: "Equal"
value: "ci"
effect: "NoSchedule"
To make sure CI pods prefer or require those nodes, add node affinity or a node selector, such as:
nodeSelector:
workload: ci
In that setup, the taint keeps unrelated pods away. The toleration lets CI pods run there. The node selector directs CI pods to the intended node pool.
These features are related, but they solve different scheduling problems:
A practical pattern is to use taints and tolerations for exclusion, then use node affinity for placement. For example, taint a database node pool with dedicated=db:NoSchedule, add a matching toleration to database pods, and add node affinity so those pods target nodes labeled workload=db.
operator: Exists may allow pods onto nodes you meant to reserve.dedicated, workload, or hardware.gpu, ci, db, or airflow.kubectl describe pod. Scheduler messages usually explain which taint was not tolerated.Kubernetes taints and tolerations give you a practical way to control workload placement. Taints mark nodes as restricted. Tolerations let approved pods run on those nodes. For predictable scheduling, use them with node labels, node selectors, and node affinity.