If there is a requirement of scheduling a pod specifically on a master node (mas . . .

Priyanka Sharma:
If there is a requirement of scheduling a pod specifically on a master node (master node has a NoSchedule taint) — then there are two ways to go about it:

  1. Remove the taint from the master node itself.
  2. Add a toleration to pod
    If it’s not specified in the question we can use either approach right? Or should we always prefer adding toleration rather removing the taint from the master node?

Leo Pastor:
Also:
3. nodeName

Try to solve the question without changing behavior of infrastructure already in place.

I would avoid removing the taint from the master node, unless the question suggests you to do so. If you did, you are allowing other pods to be scheduled in that master node, which probably is not the goal of the procedure.

Lisenet:
4. Add your Pod YAML definition to /etc/kubernetes/manifests/ on a control plane.

Priyanka Sharma:
@Leo Pastor @Lisenet Option 3 and 4 will only work if the taint is not on the controlplane/master node or the pod has toleration set for the existing taint.

Nicolás Román:
I have in my mind , for manual scheduling:
• nodeName + Toleration (without scheduler )
• nodeSelector + Toleration ( using scheduler)
it is right?

Leo Pastor:
@Priyanka Sharma Options 3 & 4 work without checking taints or the need of configuring tolerations. It is handled by kubelet, so bypassing the scheduler rules (provided that the node has enough resources to run the corresponding pod).

Leo Pastor:
@Nicolás Román nodeName works as mentioned in previous reply.
nodeSelector is handled by scheduler and so it takes in account node labels and also check taints and tolerations.