How to update a gke node to be preemptible?

3/29/2018

So I have created a GKE cluster but did not set the nodes as preemptive.

The specs changed, and now I need to make them preemptive.

How can I update the cluster so that its nodes become preemptible?

-- rrw
google-cloud-platform
google-compute-engine
google-kubernetes-engine

1 Answer

3/29/2018

It's not the cluster that's preemptive, but rather one of its node pools. You can't set an existing node pool to preemptive, so you'll have to create a new one with that setting enabled and delete the old one.

You can create a new node pool in that cluster with the preemptible setting enabled with the following gcloud command: gcloud container node-pools create --preemptible. You can also do it via the Console.

In order to route the pods from the old node pool to the new one, all you have to do is delete the old node pool, so as long as you don't have pods with node selectors. You can do that with gcloud: gcloud container node-pools delete. You can also delete the node pool in the Console too, it should work the same.

For future reference, here's what the documentation says about deleting a node pool:

Deleting a node pool deletes the nodes and routes to them. Any Pods running on those nodes are evicted and rescheduled. If the Pods have specific node selectors, the Pods might remain in an unschedulable condition if no other node in the cluster satisfies the criteria.

-- Lopson
Source: StackOverflow