K8s by Example: Taints & Tolerations
| Taints mark nodes to repel Pods; tolerations allow Pods to schedule onto tainted nodes. Unlike affinity (attracting Pods to nodes), taints work by repulsion. Use for: dedicated nodes, GPU nodes, maintenance, preventing workloads from specific hardware. |
| taint-effects.yaml | |
| Three taint effects: | |
| toleration-exact.yaml | |
| The | |
| toleration-exists.yaml | |
| The | |
| toleration-seconds.yaml | |
|
| |
| dedicated-nodes.yaml | |
| Dedicated nodes pattern: taint nodes for specific teams/workloads. Only Pods with matching tolerations (and affinity for targeting) can run there. Prevents noisy neighbors and enables cost allocation. | |
| maintenance-drain.yaml | |
| Maintenance workflow: taint node with | |
| built-in-taints.yaml | |
| Kubernetes adds taints automatically for node conditions. Default tolerations allow Pods 5 minutes before eviction. Override with your own tolerations. Common built-in taints handle node failures gracefully. | |
| terminal | |
| Manage taints with kubectl. Add taints to repel Pods, remove taints (with minus suffix) to allow scheduling. View taints in node description or get nodes output. | |