Creating a zonal cluster

This topic shows you how to create a standard zonal cluster with the default features enabled in Google Kubernetes Engine (GKE). Zonal clusters have a single control plane in a single zone. Depending on your availability requirements, you can choose to distribute your nodes for your zonal cluster in a single zone or in multiple zones.

You can read more about the types of clusters you can create.

Single zone versus multi-zonal

A single-zone cluster has a single control plane running in one zone. This control plane manages workloads on nodes running in the same zone.

A multi-zonal cluster's nodes run in multiple zones, but it has only a single replica of the control plane. 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.

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

If you receive the error One of [--zone, --region] must be supplied: Please specify location, complete this section.

  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
  • Multi-zonal clusters use more resources than single-zone clusters. If you are creating a multi-zonal cluster, ensure you have adequate quotas.

Create a zonal cluster

You can create a zonal by using the gcloud tool or the Google Cloud Console.

gcloud

To create a 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 cluster.
  • channel: the type of release channel, which can be one of rapid, regular, or stable.
  • compute-zone: the compute zone for the cluster control plane.
  • version: the version you wish to specify for your cluster.
  • In the --node-locations flag, specify a comma-separated list of compute-zone values where the control plane and nodes are created. Do not put spaces between the zone 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:

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 us-central-a zone, and there are three node locations.

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.

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

Console

To create a zonal cluster with the Google Cloud Console, perform the following tasks:

  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 Zonal, and then select the desired zone for your cluster.
    3. If you are creating a multi-zonal cluster, select the Specify node locations checkbox, and then choose additional zones in which you'd like the cluster to run.
    4. 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 e2-medium. 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.

Cluster templates

GKE previously supported templates for clusters. Those templates were removed from Google Cloud Console, but are still accessible from the following links:

What's next