Assigning Pods to Nodes (Affinity/ Anti-Affinity)

Node Affinity allows you to constrain which nodes your pods are eligible to be scheduled on based on labels that have been defined for the nodes. There are two types of node affinity that are used with OneDB.

  • requiredDuringSchedulingIgnoredDuringExecution

  • preferredDuringSchedulingIgnoredDuringExecution

requiredDuringSchedulingIgnoredDuringExecution: This is a hard requirement in that the pod “must” be scheduled on the node with the defined set of rules.

preferredDuringSchedulingIgnonredDuringExecution: This is a soft requirement in that the pod will prefer or try to schedule on nodes with the defined rules but it is not guaranteed.

Note: OneDB uses these rules to force a pod to be scheduled on a specific set of nodes or prefer to be scheduled on a specific set of nodes.
Pod anti-affinity allows you to constrain which nodes your pod is eligible to be scheduled on based on pods that are already running on the node. As with node affinity OneDB uses two types of pod anti-affinity.
  • requiredDuringSchedulingIgnoredDuringExecution

  • preferredDuringSchedulingIgnoredDuringExecution

requiredDuringSchedulingIgnoredDuringExecution: This is a hard requirement in that the pod “must” be scheduled on the node with the defined set of rules.

preferredDuringSchedulingIgnonredDuringExecution: This is a soft requirement in that the pod will prefer or try to schedule on nodes with the defined rules but it is not guaranteed.

Note: OneDB uses these rules to force a OneDB pod to not schedule on nodes already running a OneDB pod or prefer to not be scheduled on that same node.