Get in Touch
Close

Your Cloud Story,
Engineered for Success

Contacts

US Office: Obsium, 6200,
Stoneridge Mall Rd, Pleasanton CA 94588 USA

Kochi Office: GB4, Ground Floor, Athulya, Infopark Phase 1, Infopark Campus Kakkanad, Kochi 682042

+91 9895941969

hello@obsium.io

Kubernetes Taints and Tolerations

Kubernetes Taints and Tolerations

Understanding Kubernetes Taints and Tolerations

Taints and tolerations work together to control which Pods can be scheduled onto which nodes, but from the opposite direction of node affinity. A taint is applied to a node and repels Pods by default; a toleration is applied to a Pod and allows it (but does not require it) to be scheduled onto nodes carrying a matching taint. In short: taints say don’t schedule here unless you tolerate this, and tolerations say I’m okay running on a node with this taint.

How Taints and Tolerations Work

A taint has three parts: a key, an optional value, and an effect. The three effects are NoSchedule (the scheduler won’t place new Pods here unless they tolerate it), PreferNoSchedule (the scheduler tries to avoid it but isn’t guaranteed to), and NoExecute (existing Pods without a matching toleration are evicted, and new ones are blocked). Applying a taint is done with kubectl taint nodes node1 key=value:NoSchedule. A Pod tolerates it by specifying a matching toleration in spec.tolerations with the same key, value, and effect (or using the Exists operator to match any value).

Simple Example

A platform team dedicates a pool of GPU nodes to machine learning workloads and doesn’t want general-purpose Pods accidentally landing there and consuming expensive capacity. They taint every GPU node with kubectl taint nodes gpu-node-1 workload=gpu:NoSchedule. Only Pods with a toleration for key workload, value gpu, effect NoSchedule can be scheduled there – everything else is repelled. The ML team’s Pods add the matching toleration and, usually, a nodeAffinity rule preferring those same nodes, since a toleration alone only permits scheduling there, it doesn’t attract it.

Common Use Cases

Dedicated Node Pools

Reserving GPU, high-memory, or licensed-software nodes for specific workloads while keeping general workloads off them.

Control Plane Isolation

Kubernetes taints control plane nodes by default (node-role.kubernetes.io/control-plane:NoSchedule) so ordinary workloads don’t compete with API server and etcd for resources.

Graceful Eviction on Node Problems

Kubernetes automatically applies NoExecute taints like node.kubernetes.io/not-ready and node.kubernetes.io/unreachable, evicting Pods from problem nodes after a configurable toleration period (tolerationSeconds), unless a Pod explicitly tolerates the condition for longer.

Benefits of Taints and Tolerations

  • Provide node-level exclusion policy without having to label and select every workload for every eligible node.
  • Enable safe multi-tenant clusters where sensitive or specialized capacity is protected from accidental use.
  • Integrate with automatic node-condition handling, giving Pods fine-grained control over how long they tolerate degraded nodes before eviction.

Limitations and Risks

  • A toleration only permits scheduling – it doesn’t attract Pods to a node, which is a common source of confusion; teams often need affinity rules alongside tolerations to actually steer Pods to tainted nodes.
  • Overusing NoExecute taints without understanding tolerationSeconds can cause mass Pod evictions during transient node issues.
  • Forgetting to add a toleration for a legitimate workload results in Pods stuck Pending with a confusing FailedScheduling event.
  • Taints don’t provide security isolation – they’re a scheduling hint, not an enforcement boundary; a misconfigured toleration with an Exists operator can accidentally bypass an intended restriction.

Best Practices

  • Pair taints with corresponding nodeAffinity rules on the workloads meant to use that pool, so Pods are both permitted and preferred to land there.
  • Use NoSchedule for hard exclusion and PreferNoSchedule only when a soft preference is genuinely acceptable.
  • Set tolerationSeconds deliberately for NoExecute tolerations so Pods aren’t evicted too aggressively or too slowly during node trouble.
  • Document which taints exist in a cluster and why, since they’re invisible unless someone runs kubectl describe node.
  • Use taints for dedicating capacity, not as a substitute for RBAC or network policy when real security isolation is required.

Frequently Asked Questions

What is Kubernetes Taints and Tolerations?

Taints and tolerations control Pod placement from the node side: a taint on a node repels Pods by default, and a toleration on a Pod allows, but doesn't require, scheduling onto that node.

How does Kubernetes Taints and Tolerations work?

Kubernetes Taints and Tolerations works by combining the components described in the sections above. The main page walks through the architecture, the typical use cases, and the trade-offs to weigh before adopting it.

Why does Kubernetes Taints and Tolerations matter?

Teams adopt Kubernetes Taints and Tolerations to ship faster, run more reliably, and reduce the cognitive load on engineers. The benefits, limits, and adjacent tools are covered in the body above.

When should you use Kubernetes Taints and Tolerations?

Use Kubernetes Taints and Tolerations when the problems it solves match what your team is hitting today. The page above outlines the signals that mean you should adopt it now, and the cases where a simpler approach is fine.