LAB04b: Taint & Toleration
LAB 18: Taint & Toleration
STEP 1 — Taint k8s-cluster-w2
k8s-cluster-w2kubectl taint nodes k8s-cluster-w2 env=prod:NoSchedulekubectl describe node k8s-cluster-w2 | grep Taints -A3Taints: env=prod:NoScheduleSTEP 2 — Try scheduling a Pod with nodeSelector
nodeSelectorRun nginx pod targeting worker-2:
kubectl run test-nginx \
--image=nginx \
--restart=Never \
--overrides='
{
"apiVersion": "v1",
"spec": {
"nodeSelector": {
"kubernetes.io/hostname": "k8s-cluster-w2"
}
}
}'STEP 3 — Verify pod is stuck in Pending
STEP 4 — Delete the failed Pod
STEP 5 — Recreate with toleration (should work)
STEP 6 — Confirm Pod is running
✔️ Summary of behavior
Pod
Toleration
Result
Remove the taint env=prod:NoSchedule
env=prod:NoScheduleVerify taint is removed
⚠️ If you don't remember the exact taint
Need help checking if any pods become schedulable now?
Last updated