Issue#
On a fresh single-node (or small) kubeadm cluster, new pods stay in Pending forever:
kubectl get pods
NAME READY STATUS RESTARTS AGE
web-6d4cf56db6-x7k2p 0/1 Pending 0 4m
kubectl describe pod shows a FailedScheduling event:
Warning FailedScheduling default-scheduler 0/1 nodes are available: 1 node(s) had untolerated taint {node-role.kubernetes.io/control-plane: }. preemption: 0/1 nodes are available: 1 Preemption is not helpful for scheduling.
Cause#
kubeadm init adds the taint node-role.kubernetes.io/control-plane:NoSchedule to every control-plane node. This keeps normal workloads off the control plane. If the cluster has no worker nodes, or all workers are NotReady, the scheduler has nowhere to place the pod.
Check which taints are present:
kubectl get nodes -o custom-columns=NAME:.metadata.name,TAINTS:.spec.taints
Solution#
- Option A: add a worker node (recommended for production). Print a join command on the control plane and run it on the new node:
kubeadm token create --print-join-command
- Option B: allow workloads on the control plane (single-node / lab clusters). Remove the taint from all nodes. The trailing
-means "remove":
kubectl taint nodes --all node-role.kubernetes.io/control-plane-
Older clusters (before v1.25) may also have the legacy taint:
kubectl taint nodes --all node-role.kubernetes.io/master-
A taint "..." not found message only means the node never had that taint. It is safe to ignore.
- Option C: let specific pods tolerate the taint. Keep the taint and add a toleration to the pod spec only for workloads that should run on the control plane:
spec:
template:
spec:
tolerations:
- key: node-role.kubernetes.io/control-plane
operator: Exists
effect: NoSchedule
kubectl apply -f deployment.yaml
Tip: If the scheduler message mentions
node.kubernetes.io/not-readyinstead, the taint is not the problem. The node itself is unhealthy, usually because no CNI plugin is installed yet. Check it withkubectl describe node <node>.
Verify#
Confirm the taint is gone (Option B):
kubectl describe nodes | grep -i taints
# Taints: <none>
The pending pods should be scheduled within a few seconds:
kubectl get pods -o wide
NAME READY STATUS RESTARTS AGE NODE
web-6d4cf56db6-x7k2p 1/1 Running 0 5m cp-1
To restore the default later, re-apply the taint:
kubectl taint nodes <node-name> node-role.kubernetes.io/control-plane=:NoSchedule