Schedule Pods Using Taints, Tolerations and Node Affinity
Scenario
A node in your Kubernetes cluster is tainted with key dedicated, value prod, and effect NoSchedule. The same node is labeled with dedicated=prod.
Create a Deployment named web-app in the prod namespace using the nginx image with 2 replicas. Configure the Deployment with appropriate tolerations and required node affinity so that the pods are scheduled only on the tainted and labeled node.
Finally, verify that all pods in the prod namespace are in the Running state and confirm that they are scheduled on the intended node.
Do not remove the taint or modify the existing node configuration.
Hint
You need two things in your Deployment spec:
tolerations— to allow scheduling on the taintednode-02affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution— to force scheduling only on nodes labeleddedicated=prod