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
To prepare for this task, perform the following steps:
- Ensure that you have enabled the Google Kubernetes Engine API. Enable Google Kubernetes Engine API
- Ensure that you have installed the Cloud SDK.
- 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 using
gcloud or the Google Cloud Console.
To create a regional cluster, run the following command:
gcloud container clusters create [CLUSTER_NAME] \ --region [REGION] \ [--node-locations [COMPUTE_ZONE],[COMPUTE_ZONE]...]]
[CLUSTER_NAME] is the name you choose for the regional
[REGION] is the desired [region][rz], such as
us-central1. For regions with more than three zones or in cases where
fewer zones is preferred, the optional
--node-locations flag overrides the
default zones in which the nodes are replicated.
For example, to create 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
To create 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
To create a regional cluster with six nodes in two zones (two zones,
--node-locations, with three nodes each):
gcloud container clusters create my-regional-cluster \ --region us-central1 \ --node-locations us-central1-b,us-central1-c
You can specify a release channel using the
--release-channel flag, or
specify an exact cluster version using the
--cluster-version flag. If you
use neither, your cluster uses the current default version.
To create a regional cluster, perform the following steps.
Visit the Google Kubernetes Engine menu in the Cloud Console.
Click Create cluster.
Choose the Highly Available cluster template.
Choose the version of the cluster by selecting one of the following:
- Choose the release channel the cluster is enrolled in. Your cluster and node pools will be auto-upgraded within that channel.
- Choose a specific GKE version. Auto-upgrade is enabled by default, and your cluster and its node pools will be auto-upgraded when its current version is selected for auto-upgrade.
- Choose the default version. Auto-upgrade is enabled by default, and your cluster and its node pools will be auto-upgraded when its current version is selected for auto-upgrade.
Using release channels is recommended. If you must specify a version, leaving auto-upgrade enabled is recommended.
Verify that under Location type, Regional is selected.
From the Region drop-down menu, select the desired region, such as
Configure your cluster as desired, then click Create.
After you create a cluster, you need to
before you can interact with the cluster from the command line.