Ceci Ivanov:
if control plane has NoSchedule taint (the default one), is there any way with NodeSelector or Affinity to schedule some pod exactly on control plane regarding the NoSchedule taint it has or I have to set a toleration?
Radoslaw Czajkowski:
as far as i know - it’s not possible, as nodeselector and affinity is based on a scheduling algorithm which takes taints and tolerations into account
Track Buddy:
Must set a toleration…nodeselector and affinity direct the scheduler to try deploying on specific nodes but when it tries…taints prohibits and takes precedence to my understanding
Ceci Ivanov:
so there are 2 solutions, either I untaint the node on control plane and then choose one of the ways to schedule it on that or I set a toleration to the pod and alongside with nodeselector/affinity I schedule it on control plane?
Radoslaw Czajkowski:
“nodename” bypasses a scheduler so taints and tolerations are not checked
Radoslaw Czajkowski:
yes, apart from nodeselector/affinity you would need to add tolerations
Ceci Ivanov:
yeah but if I don’t want to just nodename I must use toleration that’s the only way
Ceci Ivanov:
ok ok
Track Buddy:
Toleration is better…this gives pod to choose one of the available nodes…but nodename targets specific node…whereas nodeaffinity defines a list of criteria for node selection…mind the diiferences
Track Buddy:
@Radoslaw Czajkowski r u saying if nodename is mentioned in pod.yaml and u also hav noschedule set as taint…the pod will still run on that node bypassing taint?
Radoslaw Czajkowski:
@Track Buddy yes, exactly, it bypasses the scheduler, taints and tolerations are part of the scheduler process - i confirmed this behavior in my lab some time ago
Track Buddy:
Ok…that’s a interesting find.
Lakshmi Narayana Muvvala:
Node affinity<Assigning Pods to Nodes | Kubernetes >
Node affinity is conceptually similar to nodeSelector
, allowing you to constrain which nodes your Pod can be scheduled on based on node labels. There are two types of node affinity:
• requiredDuringSchedulingIgnoredDuringExecution
: The scheduler can’t schedule the Pod unless the rule is met. This functions like nodeSelector
, but with a more expressive syntax.
• preferredDuringSchedulingIgnoredDuringExecution
: The scheduler tries to find a node that meets the rule. If a matching node is not available, the scheduler still schedules the Pod.