Answers: <p>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):</p>
  
  <pre><code>oldpool=pool-1
  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 "----------------------------"
  done;
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2018-12-07T16:32:55.923Z
Answers: On aws using kops everything this automatically
Answers: c4f4t0r
Answers: CC BY-SA 4.0
Answers: 2018-09-08T14:32:38.633Z
Answers: 2018-09-08T14:32:38.633Z
Answers: MTvB
Answers: <p>1). Inside the node pool(lets call it <strong><em>old_node_pool</em></strong> ) that you want to delete, First Cordon all the nodes one after the other. </p>
  
  <pre><code> kubectl cordon &lt;name_of_node_1&gt;
   kubectl cordon &lt;name_of_node_2&gt;
             ........ 
  </code></pre>
  
  <p>2). Drain all the nodes of the <strong><em>old_node_pool</em></strong>.</p>
  
  <pre><code> kubectl drain &lt;name_of_node_1&gt;
   kubectl drain &lt;name_of_node_2&gt;
             ........ 
  </code></pre>
  
  <p>3). Wait to see all the pods are up and running on the new node pool.</p>
  
  <p>4). Delete the old node pool.</p>
  
Answers: CC BY-SA 4.0
Answers: 2018-11-06T15:53:03.680Z
Answers: 2018-11-06T15:53:03.680Z
Answers: Suhas Chikkanna
Body: <p>I am using Google Kubernetes Engine.
  I have a multiple Kubernetes cluster node-pools.
  I want to delete one of them.</p>
  
  <p>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?</p>
  
  <p>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. </p>
  
  <p>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?</p>
  
  <p>Thanks</p>
  
Tags: <kubernetes><google-cloud-platform><google-compute-engine>
Title: How to Remove a Kubernetes (GKE) Cluster node-pool without down-time
UserDisplayName: Inbar Rose
ThreadText: # How to Remove a Kubernetes (GKE) Cluster node-pool without down-time
  
  (Asked by: username_0 on 2018-06-06)
  
  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?
  
  Thanks
  
  **Tags:** kubernetes, google-cloud-platform, google-compute-engine
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2018-09-08. Score: 3
  
  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):
  
  ```
  oldpool=pool-1
  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 "----------------------------"
  done;
  
  ```
  
  > **Comments:**
  > **username_2**: On aws using kops everything this automatically  
  
  ---
  
  ### Answer by username_3 on 2018-11-06. Score: 1
  
  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.
  
  
  ---
  
  