Hi @Tej_Singh_Rana @Vijin Palazhi I am taking mock exam 3 For Question Number 6 . . .

Bhushan G:
Hi @Tej_Singh_Rana @Vijin Palazhi I am taking mock exam 3
For Question Number 6 regarding tainting nodes.
after adding toleration while I try to run a pod on node01 its not getting scheduled on node01 it runs on node02 instead. Below is the code which I tried.

apiVersion: v1
kind: Pod
metadata:
  name: prod-redis
spec:
  containers:
  - name: prod-redis
    image: redis:alpine
  tolerations:
  - effect: NoSchedule
    key: env_type
    operator: Equal
    value: production

But later it worked while I added the nodeSelector parameter.
apiVersion: v1
kind: Pod
metadata:
name: prod-redis
spec:
containers:

Tej_Singh_Rana:
Hello, @Bhushan G
Yeah, I checked the question and it got scheduled on node02 and sometimes node01 or node03. Maybe it’s happening due to availability of multiple nodes.
You can use the kubectl cordon command to mark nodes as UnSchedulable (node02 and node03) and then try to deploy that pod. It will get scheduled on node01.
For nodeSelector, that’s a good combination with tolerations.
nodeSelector, identify the desire node by it’s node labels and tolerations will tolerate the taints of that node.
That’s why it worked perfectly.