Change nodepool instance type in GKE

In GKE, sometimes the instance type you have chose to deploy your application might not be enough and you may need to change it. If that is what you need then follow along. Here, I already have setup gcloud and changing the instance type to custom machine with 4 CPUs and 16GiB RAM.

Create a separate node-pool

gcloud container node-pools create medium-pool --disk-size=30 --cluster cluster-1 --machine-type custom-4-16384 --enable-autoscaling --num-nodes 1 --min-nodes 1 --max-nodes 5


medium-pool is the name of nodepool
--disk-size is the size of disk for each node
--cluster is the existing cluster name
--machine-type is the name of custom machine in the form of custom-{cpu}-{ram in mib}

Cordon each node. This means you are marking nodes as unschedulable.

for node in $(kubectl get nodes -l -o=name); do
   kubectl cordon "$node";

Evict the pods. Take caution.

for node in $(kubectl get nodes -l -o=name); do
   kubectl drain --force --ignore-daemonsets --delete-local-data --grace-period=10 "$node";


old-pool is the name of old pool which we will remove

Remove old node pool

gcloud container node-pools delete old-pool --cluster cluster-1

List the nodepool, you should have only one running

gcloud container node-pools list --cluster cluster-1

 medium-pool  custom-4-16384  30            1.18.17-gke.100

Read details:

Leave a Reply

Your email address will not be published. Required fields are marked *