This topic shows how to create a multi-zonal cluster to increase availability of the cluster's workloads during a zonal disruption. A multi-zonal cluster's nodes run in multiple zones, but it has only a single replica of the control plane (master). If you need higher availability for the control plane, consider creating a regional cluster instead. In a regional cluster, the control plane is replicated across multiple zones in a region.
You can read more about the types of clusters you can create.
Once you create a multi-zonal cluster, you cannot convert it to a single-zone or regional cluster.
Before you begin
Before you start, make sure you have performed the following tasks:
- Ensure that you have enabled the Google Kubernetes Engine API. Enable Google Kubernetes Engine API
- Ensure that you have installed the Cloud SDK.
Set up default
gcloud settings using one of the following methods:
gcloud init, if you want to be walked through setting defaults.
gcloud config, to individually set your project ID, zone, and region.
Using gcloud init
If you receive the error
One of [--zone, --region] must be supplied: Please specify
location, complete this section.
gcloud initand follow the directions:
If you are using SSH on a remote server, use the
--console-onlyflag to prevent the command from launching a browser:
gcloud init --console-only
Follow the instructions to authorize
gcloudto use your Google Cloud account.
- Create a new configuration or select an existing one.
- Choose a Google Cloud project.
- Choose a default Compute Engine zone.
Using gcloud config
- Set your default project ID:
gcloud config set project project-id
- If you are working with zonal clusters, set your default compute zone:
gcloud config set compute/zone compute-zone
- If you are working with regional clusters, set your default compute region:
gcloud config set compute/region compute-region
gcloudto the latest version:
gcloud components update
- Multi-zonal clusters use more resources than single-zone clusters. Ensure you have adequate quotas.
Creating a multi-zonal cluster
You can create a multi-zonal by using the
gcloud tool or the
Google Cloud Console.
To create a multi-zonal cluster with the
gcloud command-line tool, use one
of the following commands.
Replace the placeholder values in the commands with the following:
- cluster-name: the name of your new multi-zonal cluster cluster.
- channel: the type of release channel,
which can be one of
- compute-zone: the compute zone for the cluster control plane.
- version: the version you wish to specify for your cluster.
--node-locationsflag, specify a comma-separated list of compute-zone values where the control plane and nodes are created.
Using a release channel:
gcloud beta container clusters create cluster-name \ --release-channel channel \ --zone compute-zone \ --node-locations compute-zone,compute-zone,[...]
Using the default version:
gcloud container clusters create cluster-name \ --zone compute-zone \ --node-locations compute-zone,compute-zone,[...]
Using a specific version:
gcloud container clusters create cluster-name \ --cluster-version version \ --zone compute-zone \ --node-locations compute-zone,compute-zone,[...]
Example: The following command creates a multi-zonal cluster named
example-cluster, where the cluster control plane is located in the
zone, and there are three node locations.
--num-nodes flag is omitted, the default number of per-zone nodes
created by the cluster is three. Because three zones were specified, this
command creates a nine-node cluster with three nodes each in
gcloud container clusters create example-cluster \ --zone us-central1-a \ --node-locations us-central1-a,us-central1-b,us-central1-c
Visit the Google Kubernetes Engine menu in Cloud Console.
Click the Create cluster button.
In the Cluster basics section, complete the following:
- Enter the Name for your cluster.
- For the Location type, select Zonal, and then select the desired zone for your cluster.
- Select the Specify node locations checkbox, and then choose additional zones in which you'd like the cluster to run.
Choose a Master Version. We recommend selecting a release channel. If you must specify a static version, ensure auto-upgrade is enabled for your node pools.
From the navigation pane, under Node Pools, click default-pool.
In the Node pool details section, complete the following:
From the navigation pane, under Node Pools, click Nodes.
From the Image type drop-down list, select the desired node image.
Choose the default Machine configuration to use for the instances. Each machine type is billed differently. The default machine type is
n1-standard-1. For machine type pricing information, refer to the machine type price sheet.
From the Boot disk type drop-down list, select the desired disk type.
Enter the Boot disk size.
After you create a cluster, you need to
before you can interact with the cluster from the command line.