Creating a multi-zonal cluster

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

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]
  • Update gcloud to 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 cluster using gcloud or the Google Cloud Console.

gcloud

To create a multi-zonal cluster, set --zone to the zone for the cluster control plane, and set --node-locations to a comma-separated list of compute zones where the control plane and nodes are created. Use one of the following commands. The first variant of the command uses a release channel, and the second variant uses the default version. To specify an exact version, use the --cluster-version flag instead of --release-channel.

Replace the placeholder values, such as [CLUSTER-NAME], with appropriate values.

Using a release channel:

gcloud 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:

Replace [VERSION] with a specific version.

gcloud container clusters create [CLUSTER_NAME] \
    --cluster-version [VERSION] \
    --zone [COMPUTE_ZONE] \
    --zone [COMPUTE_ZONE] \
    --node-locations [COMPUTE_ZONE],[COMPUTE_ZONE],[...]

For example:

gcloud container clusters create example-cluster \
    --zone us-central1-a \
    --node-locations us-central1-a,us-central1-b,us-central1-c

When the --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 us-central1-a, us-central1-b, and us-central1-c.

Console

To create a multi-zonal cluster, perform the following steps.

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

    Visit the Google Kubernetes Engine menu

  2. Click Create cluster.

  3. Choose the Standard cluster template or choose an appropriate template for your workload.

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

  5. From the Zone drop-down menu, select the desired zone for your cluster control plane, such as us-central1-a.

  6. Configure your cluster as desired, then click Advanced options.

  7. From the Additional zone locations section, select additional zones in which you'd like the cluster to run.

  8. Click Save to exit the Advanced options overlay.

  9. 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?

このページは役立ちましたか?評価をお願いいたします。

フィードバックを送信...

Kubernetes Engine Documentation