Hello friends, anyone want to revision in one thread some recap about Scheduling . . .

Ceci Ivanov:
Hello friends, anyone want to revision in one thread some recap about Scheduling pods on specific nodes. I have concluded those tips:

• If there are taints applied on nodes, we must use always a toleration on the pod in case that we want to be able to schedule it on that node. However, a toleration only doesn’t ensures that the pod will be scheduled on that specific node. If we apply a nodeSelector too to that pod then that pod will be scheduled on the node. Or another way is to taint the other nodes with other labels and then the pod will have no anywhere else to go except the node with the taint that its tolerated
• NodeSelector works as a soft preference( meaning that applying only a nodeSelector doesn’t ensure that the pod will be scheduled on that node)
• If we want a hard preference we use nodeAffinity (with requiredDuringSchedulingIgnoredDuringExecution) and with that and only that the pod will be scheduled to the specific node we want
• If we want to prevent of a node containing two or more same pods we use podAntiAffinity, or if we want to ensure that a pod is scheduled always on a node that has other specific pod we use podAffinity
• Combination of nodeSelector and affinity rules i think it’s useless because the affinity is like the nodeSelector but just with more options and option for hard/soft preference
If i am making some wrong assumption here please tell me! thanks

Trung Tran:
Nice job, thanks for sharing with the community @Ceci Ivanov!

Trung Tran:
For the 1st bullet, actually if you use nodeName, it will ignore the taint, as in this case, kubelet will handle the pod placement instead of scheduler!
https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodename

Trung Tran:
This post explain clearly ways to assign a pod into a specific node. https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/

Santosh Kaluskar:
Hi, while scheduling a pod, populating the pod manifest with nodeName field is bad-practice?
As this completely bypasses the kube-scheduler.

Trung Tran:
Agree @Santosh Kaluskar, just bring up a topic to discuss, thanks for sharing the feedback!

Santosh Kaluskar:
Thanks, the only shortfall I see using the nodeName is in the Cloud as:
> • Node names in cloud environments are not always predictable or stable.
Am I missing something important here wrt scheduling?

Alistair Mackay:
Node names are never predictable or stable. Even on a self managed cluster it may be necessary to replace a malfunctioning node