Kubernetes CKA sample exam question 27 with answer

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 state
Get some events:
kubectl describe po nginx-pod
We can notice from events that nodes have taits that pod didn't tolerate:
{color: blue} on 1 node - probably this is node01
{node-role.kubernetes.io/master} on another node - this should be a controlplane
Make sure of above:
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.
Get the pod manifest:
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