Hi Guys, Need inputs What is the best possible way to make node unschedulable: 1 . . .

Rakesh Kumar Parida:
Hi Guys,
Need inputs
What is the best possible way to make node unschedulable:

  1. taint the node with NoSchedule
    or
  2. drain node
    or
  3. cordon the node

Francesco:
From my point of view it depends on the scenario.
If you need to do maintenance, then “cordon” - “drain”
If for other reasons you don’t want pod, then a “NoExecute” taint is the best because in addition to not scheduling, it also moves the present ones.
While with “NoSchedule” there is still the possibility that in case of need some pod can be placed on the node.

George Lazaroff:

kubectl cordon <node name>

Rakesh Kumar Parida:
I guess the best way to is to drain if I want to make node unschedule.

George Lazaroff:
@Rakesh Kumar Parida your question is - make node unschedulable

Marking a node as unschedulable prevents the scheduler from placing new pods onto that Node, but does not affect existing Pods on the Node. This is useful as a preparatory step before a node reboot or other maintenance.
To mark a Node unschedulable, run:

kubectl cordon $NODENAME

https://kubernetes.io/docs/concepts/architecture/nodes/

George Lazaroff:
• kubectl conrdon - put label - <http://node.kubernetes.io/unschedulable|node.kubernetes.io/unschedulable>: Node is unschedulable.

Rakesh Kumar Parida:
Thanks @George Lazaroff, I got my answers, I don’t want my existing pod then I should go for cordon,thanks for the great explantion :slightly_smiling_face: appreciate

George Lazaroff:
cordon - Marking a node as unschedulable prevents the scheduler from placing new pods onto that Node,
drain - Safely evict all of your pods from a node before you perform maintenance on the node (e.g. kernel upgrade, hardware maintenance, etc.). Safe evictions allow the pod’s containers to <https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-termination|gracefully terminate> and will respect the PodDisruptionBudgets you have specified.
> Note: By default kubectl drain ignores certain system pods on the node that cannot be killed; see the <https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands/#drain|kubectl drain> documentation for more details.