Kubernetes CKA sample exam question 75 with answer

Question
Create a Pod by name cka-pod of image nginx. This Pod should be scheduled on a master node(s). Do not make any change in the node.

Answer Get env details:

kubectl get no
Check for taints on controlplane node:
kubectl describe no controlplane |grep -i taint
The output is:
node-role.kubernetes.io/controlplane:NoSchedule
Check the applied labes on controlplane node:
kubectl get no --show-labels
The default label will be used when constructing pod manifest:
node-role.kubernetes.io/control-plane:
Generate po manifest:
kubectl run cka-pod --image=nginx --dry-run=client -o yaml
Adjust the manifest:
apiVersion: v1
kind: Pod
metadata:
  name: cka-pod
spec:
  containers:
  - name: cka-pod
    image: nginx
  tolerations:
  - key: node-role.kubernetes.io/master
    effect: NoSchedule
  nodeSelector:
    node-role.kubernetes.io/control-plane:
Apply and check:
kubectl apply -f po.yaml
kubectl get po -o wide
the pod should be scheduled on controlplane node