Singam Nagasai Reddy:
Hi can anyone tell me how to make a node unavailable and reschedule the pod?
Sheejith:
Drain the node
Singam Nagasai Reddy:
drain will evicts the resources but it doesnt make the node unvailable right
Swapnil S:
stop the kubernetes service on that node
Singam Nagasai Reddy:
if the pod is using local storage then
Sheejith:
if pod is local to the node create a replica and schedule it on different node. corden happens as soon as you drain the node so no need to mark it unavailable once you drain it as it would already be in unschedulable state
Singam Nagasai Reddy:
i have tried drain node01 but the pod sits in node01 only
Sheejith:
you have to use force option
Singam Nagasai Reddy:
yes used this command kubectl drain <nodename> --ignore-daemonsets --delete-emptydir-data --delete-local-data
Singam Nagasai Reddy:
–force
Singam Nagasai Reddy:
but using drain only deployments and replicasets will sit in another nodes right pods will get deleted
Sheejith:
–ignore-daemonsets –force --delete-local-data
when you say “Unavailable”, I understand it to be “unschedulable”. The right way to make a node unschedulable and move the pods to another node is to run the following command from the master node:
kubectl drain --ignore-daemonsets
This adds a taint of effect NoSchedule to the node and moves the pods which are part of a ReplicaSet to another node. Note that if they are not part of a ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet, i.e they are single/lone pods, they are lost forever but require that you use the --force option while draining
kubectl drain --ignore-daemonsets --force
Please read the dopcumentation and play around so that you get a good grasp of this topic. Cheers!