How to get fresh list of GKE worker nodes using k8s client-go

6/21/2019

I am using k8s client-go SDK's NodeInterface to get list of all nodes of GKE cluster. API returns the list correctly. When I update (reduce) size of GKE node-pool, some of the worker nodes gets killed. I wait for cluster to become stable.

Invoking same API to list all GKE nodes including one that have got killed. Do I need to wait for some more time to get updated list of worker nodes ? OR Am I missing something here ?

-- vinayakshnd
client-go
google-kubernetes-engine
kubernetes

1 Answer

6/26/2019

After reducing the node-pool size the node being removed gets status "Cordoned" and after a while disappears from the list. Usually it takes one-two minutes.

Hence you should wait a bit in order to let the cluster to compete node removal.

-- mebius99
Source: StackOverflow