How do you tell a pod to schedule on a specific node? just with taint and tolera . . .

Samir:
How do you tell a pod to schedule on a specific node? just with taint and tolerations or do you use something else? there are many different ways and I still get a bit confused which is best practive

Tanumoy Ghosh:
You can use manual scheduling as below if the pod is not already running

spec:
  nodeName: node01

For an already running node, you need to probably use tolerations and nodeSelectors.

Samir:
What is about this https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity ? I would prefere this way since if a question is that my pod has to be on a specific node than this is sure

Samir:
Like i have understood the other way with toleration is just a oft way

Samir:
or are is nodeselector also hard rule?

Fernando Jimenez:
If you use nodeName, the pod is going to be placed in that single node if the node has the capability for it, if not, it will show in pending state all the time.
If you use nodeSelector the pod can be scheduled in any node that match the key-value pair labels you are giving it. The key is that there could be more than one node that could receive that pod.
If you use node affinity if similar to nodeSelector but you are allow to include a bit more dynamic logic to it and some rules for the case if the node has changed after the pod has been scheduled on it and some rules for the moment of scheduling it.

Basavraj Nilkanthe:
@Fernando. This is good explanation on options available for selecting specific nodes to schedule pod… In the exam… nodeName should be enough until it is more scenario based question…