Node Access Control: Checkpoint System for Pod Scheduling
k8s/labs/scheduling/tolerations/tolerations-pod.yaml — Pod declaring tolerations so it can schedule onto tainted nodes.k8s/labs/scheduling/tolerations/no-tolerations-pod.yaml — Pod without tolerations (illustrates blocking on tainted nodes).Taints repel pods unless they have matching tolerations (permits) to override the restriction.
| Effect | New Pods | Existing Pods | Use Case |
|---|---|---|---|
| NoSchedule | Blocks scheduling | No impact | Reserve nodes for specific workloads |
| PreferNoSchedule | Tries to avoid | No impact | Soft preference, not strict |
| NoExecute | Blocks scheduling | Evicts immediately | Maintenance mode, force evacuation |
operator: Exists matches the taint key only (ignores value). Example: tolerate any gpu taint regardless of value.
# Apply NoSchedule taint for GPU node kubectl taint nodes worker-node-1 \ gpu=true:NoSchedule # Apply NoExecute for maintenance kubectl taint nodes worker-node-2 \ maintenance=true:NoExecute # Remove taint (note the minus) kubectl taint nodes worker-node-1 \ gpu=true:NoSchedule-
apiVersion: v1
kind: Pod
metadata:
name: ml-workload
spec:
tolerations:
- key: "gpu"
operator: "Equal"
value: "true"
effect: "NoSchedule"
containers:
- name: tensorflow
image: tensorflow/tensorflow:latest-gpu
resources:
limits:
nvidia.com/gpu: 1
kubectl describe node <name> - View node taintskubectl describe pod <name> - Check why pod is pending