Hi Team What is the differnce between nodeSelector and nodename in scheduling?

Trinetra S:
Hi Team
What is the differnce between nodeSelector and nodename in scheduling?

Eyal Solomon:
@Chiranga Alwis @Tej_Singh_Rana
correct me if im wrong

NodeSelector - a way to determine where a Pod will be Scheduled - can be used at the simplest form

  disktype: ssd

Or in advanced way with NodeAffinity feature

        - matchExpressions:
          - key: <http://kubernetes.io/e2e-az-name|kubernetes.io/e2e-az-name>
            operator: In
            - e2e-az1
            - e2e-az2

But NodeName itself is being added by the Scheduler after he determines where the Pod needs to be scheduled

Trinetra S:
So basically as a user If I want to do a manual scheule of pods both do the same job right?

Trinetra S:
Not nodeAffinity

Trinetra S:
comparing nodeSelectors and nodeName

Eyal Solomon:
If you want to do a manual scheduling -> you need to add the NodeName property
( Can be done where you are asked to schedule a Pod and the kube-scheduler is not working )

Chiranga Alwis:
Yes. Adding to what @Eyal Solomon has mentioned with nodeName you directly assign the name of the Node you want to schedule your workload in - thus you skip the function performed by the scheduler (by default, the default kube-scheduler) and you do it manually. This means you effectively avoid any restrictions taken into consideration such as Node Taints. You can try this out.
On the other hand, when using the NodeSelector the scheduler performs the scheduling taking into consideration the restrictions laid out for Node selection and even Taints.

Trinetra S:
So Basically nodeName has no podEviction timeout set correct?

Trinetra S:
@Eyal Solomon @Chiranga Alwis

Chiranga Alwis:
@Trinetra S I believe https://kubernetes.io/docs/reference/command-line-tools-reference/kube-controller-manager/’s --pod-eviction-timeout should work still. And I just checked. Taint based Pod eviction (i.e. the relevant tolerationSeconds of each Toleration created by default) has also been set as in these Pods as well, checkout the described Pod which I created using manual scheduling.