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:
- 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 for zonal clusters or a region for regional or Autopilot clusters.
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 Autopilot or regional clusters, set your default compute region:
gcloud config set compute/region COMPUTE_REGION
gcloudto 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.
- Ensure you have the correct permission to create clusters. At minimum, you should be a Kubernetes Engine Cluster Admin.
Create a zonal cluster
You can create a zonal cluster by using the
gcloud tool or the
Google Cloud Console.
If you're developing GKE applications with Visual Studio Code, try creating clusters with Cloud Code.
To create a zonal cluster with the
gcloud tool, use one
of the following commands.
Replace the following:
CLUSTER_NAME: the name of your new cluster.
CHANNEL: the type of release channel, which can be one of
None. By default, the cluster is enrolled in the
regularrelease channel if the following flags aren't specified:
COMPUTE_ZONE: the compute zone for the cluster control plane.
VERSION: the version you wish to specify for your cluster.
COMPUTE_ZONE,COMPUTE_ZONE1,[...]: the zones in which nodes are created. You can specify as many zones as needed for your cluster. All zones must be in the same region as the cluster's control plane, specified by the
--zoneflag. For zonal clusters,
--node-locationsmust contain the cluster's primary zone.
Using a specific 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 \ --zone COMPUTE_ZONE \ --node-locations COMPUTE_ZONE,COMPUTE_ZONE1
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 \ --zone COMPUTE_ZONE \ --node-locations COMPUTE_ZONE,COMPUTE_ZONE1
Using the static default version:
To create a new cluster using the static default cluster version, you don't
need to specify a cluster version, but you do need to set the release
gcloud container clusters create CLUSTER_NAME \ --release-channel None \ --zone COMPUTE_ZONE \ --node-locations COMPUTE_ZONE,COMPUTE_ZONE1
The following command creates a multi-zonal cluster named
where the cluster control plane is located in the
us-central-a zone, and
there are three node locations. The cluster is enrolled in the
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
gcloud container clusters create example-cluster \ --zone us-central1-a \ --node-locations us-central1-a,us-central1-b,us-central1-c
To create a zonal cluster with the Google Cloud Console, perform the following tasks:
Go to the Google Kubernetes Engine page in Cloud Console.
Click add_box Create.
In the Cluster basics section, complete the following:
- Enter the Name for your cluster.
- For the Location type, select Zonal, and then select the desired zone for your cluster.
- If you are creating a multi-zonal cluster, select the Specify default node locations checkbox, and then choose additional zones in which you'd like the cluster to run.
Choose a Control plane version. Defaults to the recommended option of Release channel. If you must specify a static version, ensure auto-upgrade is enabled for your node pools.
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.
GKE previously supported templates for clusters. Those templates were removed from Google Cloud Console, but are still accessible from the following links:
- Learn about the types of clusters you can create.
- Learn about the GKE cluster architecture.
- Learn about managing your clusters.
- Learn how to delete clusters.
Try it for yourself
If you're new to Google Cloud, create an account to evaluate how GKE performs in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.Try GKE free