k8s 13: affinity and taint/toleration

In k8s 05: scheduler, I used node selector to select which node to launch a pod, and we don’t need to use that node selector once we launched scheduler. It is because Scheduler choose the best node for the pod based on various criteria(e.g. resource balancing). But often times, we have specific requirement for a pod which environment it should be launched on. For this purpose, kubernetes uses two ways as follows:

  • Labels and Affinity …… This is used to specify the “Preference” of the launching pod to select which node/pod to be launched on/with.
  • Taints and Tolerations …… This is used to specify the “Requirement” of the node to allow launching pod to be deployed on it.