I am using Google Kubernetes Engine. I have a multiple Kubernetes cluster node-pools. I want to delete one of them.

Is there a way that I can first migrate all the pods on one node-pool to another node-pool through the same kind of rolling update methods found in other features?

I thought it would do this automatically for me. But when I deleted the node-pool I got downtime, luckily this was not a production environment.

I would like to know if there is a way to automatically migrate and move all pods from one node-pool to another node-pool and slowly roll the change when a node-pool is removed?


2 Answers 2


If you cordon and drain the nodepool before deleting it, then you can avoid downtime. I use the following script (shamelessly taken from the lazyweb elsewhere and adapted to my needs):

oldnodes=$(k get no --selector='cloud.google.com/gke-nodepool='$oldpool -o json | jq .items[].metadata.name -r | xargs)

kubectl cordon --selector='cloud.google.com/gke-nodepool='$oldpool

for n in $oldnodes; do
  echo "draining $n"
  kubectl drain --delete-local-data --ignore-daemonsets $n
  echo "----------------------------"
  • On aws using kops everything this automatically
    – c4f4t0r
    Commented Dec 7, 2018 at 16:32

1). Inside the node pool(lets call it old_node_pool ) that you want to delete, First Cordon all the nodes one after the other.

 kubectl cordon <name_of_node_1>
 kubectl cordon <name_of_node_2>

2). Drain all the nodes of the old_node_pool.

 kubectl drain <name_of_node_1>
 kubectl drain <name_of_node_2>

3). Wait to see all the pods are up and running on the new node pool.

4). Delete the old node pool.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.