Multi-zone clusters

GKE supports multi-zone clusters, which allows you to launch Kubernetes nodes on multiple zones, but within the same region. In previous examples, Kubernetes nodes have been provisioned at asia-northeast1-a only, so let's re-provision a cluster that has asia-northeast1-a, asia-northeast1-b, and asia-northeast1-c in a total of three zones.

It's very simple; you just use the --node-locations parameter to specify three zones when creating a new cluster. 

Let's delete the previous cluster and create a new one with the --node-locations option:

//delete cluster first
$ gcloud container clusters delete my-k8s-cluster --zone asia-northeast1-a
The following clusters will be deleted.
- [my-k8s-cluster] in [asia-northeast1-a]
Do you want to continue (Y/n)? y
...
...

//create a new cluster with --node-locations option with 2 nodes per zones $ gcloud container clusters create my-k8s-cluster --machine-type f1-micro --num-nodes 2 --network my-custom-network --subnetwork subnet-c --tags private --zone asia-northeast1-a --node-locations asia-northeast1-a,asia-northeast1-b,asia-northeast1-c

This example will create two nodes per zone (asia-northeast1-a, b, and c). Consequently, a total of six nodes will be added:

$ kubectl get nodes
NAME STATUS ROLES AGE VERSION
gke-my-k8s-cluster-default-pool-58e4e9a4-74hc Ready <none> 43s v1.10.9-gke.5
gke-my-k8s-cluster-default-pool-58e4e9a4-8jft Ready <none> 1m v1.10.9-gke.5
gke-my-k8s-cluster-default-pool-f7baf2e1-lk7j Ready <none> 1m v1.10.9-gke.5
gke-my-k8s-cluster-default-pool-f7baf2e1-zktg Ready <none> 1m v1.10.9-gke.5
gke-my-k8s-cluster-default-pool-fa5a04a5-bbj5 Ready <none> 1m v1.10.9-gke.5
gke-my-k8s-cluster-default-pool-fa5a04a5-d35z Ready <none> 1m v1.10.9-gke.5
You may also distinguish node zones with the failure-domain.beta.kubernetes.io/zone Kubernetes label so that you can specify the desired zones to deploy a pod.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset