Question
A pod nginx-pod (image=nginx) in default namespace is not running.
Find the problem and fix it and make it running.
Answer
Get details:
kubectl get po
we can see that the pod nginx-pod is in the Pending statekubectl describe po nginx-pod
We can notice from events that nodes have taits that pod didn't tolerate:kubectl describe node controlplane | grep -i taint
kubectl describe node node01 | grep -i taint
To schedule pod on node01 we should add a toleration color=blue:NoSchedule to the pod.kubectl get po nginx-pod -o yaml > po.yaml
Add the following toleration to it:
...
spec:
tolerations:
- key: "color"
operator: "Equal"
value: "blue"
effect: "NoSchedule"
..
Save and replace the pod:
kubectl replace --force -f po.yaml
Verify:
kubectl get po -o wide
kubectl describe po nginx-pod
Pod should be scheduled on node01 and to be in Running state