Creating a regional cluster

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:

Set up default gcloud settings using one of the following methods:

  • Using gcloud init, if you want to be walked through setting defaults.
  • Using gcloud config, to individually set your project ID, zone, and region.

Using gcloud init

  1. Run gcloud init and follow the directions:

    gcloud init

    If you are using SSH on a remote server, use the --console-only flag to prevent the command from launching a browser:

    gcloud init --console-only
  2. Follow the instructions to authorize gcloud to use your Google Cloud account.
  3. Create a new configuration or select an existing one.
  4. Choose a Google Cloud project.
  5. 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
  • Update gcloud to 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.

gcloud

Run the following command:

gcloud container clusters create [CLUSTER_NAME] \
    --region [REGION] \
    [--node-locations [COMPUTE_ZONE],[COMPUTE_ZONE]...]]

where [CLUSTER_NAME] is the name you choose for the regional cluster, and [REGION] is the desired region, 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 us-west1 (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 --num-nodes):

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, 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

You can specify a release channel using gcloud beta with the --release-channel flag.

gcloud beta container clusters create [CLUSTER_NAME] \
    --release-channel [RELEASE_CHANNEL] \
    --region [REGION] \
    [--node-locations [COMPUTE_ZONE],[COMPUTE_ZONE]...]]

You can also specify an exact cluster version using the --cluster-version flag. If you don't specify a release channel or a cluster version, your cluster uses the current default version.

Console

  1. Visit the Google Kubernetes Engine menu in Cloud Console.

    Visit the Google Kubernetes Engine menu

  2. Click the Create cluster button.

  3. In the Cluster basics section, complete the following:

    1. Enter the Name for your cluster.
    2. For the Location type, select Regional, and then select the desired region for your cluster.
    3. 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.

  4. From the navigation pane, under Node Pools, click default-pool.

  5. In the Node pool details section, complete the following:

    1. Enter a Name for the default Node pool.
    2. Choose the Node version for your nodes.
    3. Enter the Number of nodes to create in the cluster. You must have available resource quota for the nodes and their resources (such as firewall routes).
  6. From the navigation pane, under Node Pools, click Nodes.

  7. From the Image type drop-down list, select the desired node image.

  8. 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.

  9. From the Boot disk type drop-down list, select the desired disk type.

  10. Enter the Boot disk size.

  11. Click Create.

After you create a cluster, you need to configure kubectl before you can interact with the cluster from the command line.

What's next?