Aller au contenu

How to move pod to another node#

Why ?#

It may be necessary to move pods because they are on a node that has issues, or in some cases due to a poor distribution of pods that can cause disk saturation.

Action#

You must isolate the node in question with the command:

$ kubectl cordon <NAME_NODE> 

Verify#

Check the node is in SchedulingDisable state:

kubectl get node

Identify pods running on node#

kubectl get pods --all-namespaces -o wide --field-selector spec.nodeName=<NAME_NODE>

Identify the largest images#

By typing the following command on the node:

sudo docker system df -v

Move pod#

After deletion, the pod will be scheduled on another node, that is not marked as SchedulingDisable

kubectl delete <POD_NAME>

Check the new node hosting the pod#

kubectl get pods -o wide | grep  <POD_NAME>

Uncordon#

In order to allow new pods beeing scheduled on the node:

kubectl uncordon <NAME_NODE>