GKE adding nodes to a cluster that are of different sizes

2.2k Views Asked by At

Why do you have this restriction on having each replica in a cluster be of the same machine-size? What if I want to add larger nodes four cores up from 2, or nodes with more RAM? In a more general sense, why heterogeneous kubernetes cluster is restricted on GKE?

2

There are 2 best solutions below

0
On BEST ANSWER

You can have heterogenous clusters with different machine types on GKE by creating node pools with the "--machine-type" option. For example:

gcloud container node-pools create $pool-name --cluster=$cluster-name --machine-type=n1-standard-4

This blog post explains some of the scenarios you can do with them, including creating pools with custom machine types: https://cloudplatform.googleblog.com/2016/05/introducing-Google-Container-Engine-GKE-node-pools.html

Hope this helps.

Edit: Just noticed the question mentioned GCE, and not just GKE. On GCE, the setup scripts only create a single managed instance group (MIG) with a fixed machine configuration. To add nodes of different types, you can clone the instance group template used, modify the machine type, then create a new managed instance group. Resize it to your desired size. The new nodes should be able to join your cluster, giving you the desired heterogenous configuration.

0
On

You can certainly add nodes of different sizes to a cluster, it just isn't easy to do using kube-up.sh. It might be possible to do this by changing the machine types in config-default.sh and then re-running kube-up.sh setting KUBE_USE_EXISTING_MASTER=true but I haven't tested to see if this actually works (that variable was adding to support multi-zone clusters but may also allow you to create heterogenous clusters in a single zone).