This topic shows how to create a regional cluster to increase availability of the cluster's control plane and workloads during cluster upgrades, automated maintenance, or a zonal disruption. When you create a regional cluster instead of a single-zone or multi-zonal cluster, replicas of the control plane and nodes run in multiple zones of a given region. By default, a regional cluster's nodes are also replicated across the same zones as the control plane.
You can read more about the types of clusters you can create.
Once you create a regional cluster, you cannot convert it to a single-zone or multi-zonal cluster.
Regional clusters replicate resources across multiple zones and consume additional quotas.
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
Creating a regional cluster
You can create a regional cluster by using the
gcloud tool or the
Google Cloud Console.
To create a regional 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 regional cluster.
CHANNEL: the type of release channel, which can be one of
COMPUTE_REGION: the desired region for your cluster, such as
COMPUTE_ZONE: the desired zone for your nodes.
VERSION: the version you wish to specify for your cluster.
- For regions with more than three zones or in cases where fewer zones is
preferred, you can use the optional
--node-locationsflag to override the default zones in which the nodes are replicated. When using this flag, specify a comma-separated list of
COMPUTE_ZONEvalues. Do not put spaces between the zones.
Using a release channel:
To create a new cluster using a specific release channel, run the following command:
gcloud container clusters create CLUSTER_NAME \ --release-channel CHANNEL \ --region COMPUTE_REGION \ [--node-locations COMPUTE_ZONE,COMPUTE_ZONE...]]
Using a specific version:
To create a new cluster using a specific cluster version, run the following command:
gcloud container clusters create CLUSTER_NAME \ --cluster-version VERSION --region COMPUTE_REGION \ [--node-locations COMPUTE_ZONE,COMPUTE_ZONE...]]
Using the static default version:
To create a new cluster using the static default cluster version, run the following command:
gcloud container clusters create CLUSTER_NAME \ --region COMPUTE_REGION \ [--node-locations COMPUTE_ZONE,COMPUTE_ZONE...]]
The following command creates a regional cluster with nine nodes in
(three zones with three nodes each, which is default):
gcloud container clusters create my-regional-cluster --region us-west1
The following command creates a regional cluster with six nodes (three zones
with two nodes each, specified by
gcloud container clusters create my-regional-cluster \ --num-nodes 2 \ --region us-west1
The following command creates a regional cluster with six nodes in two zones
(two zones, specified by
--node-locations, with three nodes each):
gcloud container clusters create my-regional-cluster \ --region us-central1 \ --node-locations us-central1-b,us-central1-c
Visit the Google Kubernetes Engine menu in Cloud Console.
Click add_box Create.
In the Cluster basics section, complete the following:
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
e2-medium. 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.