Managing Clusters

This page shows you how to manage your clusters in Kubernetes Engine. To learn about how clusters work, refer to Cluster Architecture.

Before you begin

To prepare for this task, perform the following steps:

  • Ensure that you have enabled the Kubernetes Engine API.
  • Enable Kubernetes Engine API
  • Ensure that you have installed the Cloud SDK.
  • Set your default project ID:
    gcloud config set project [PROJECT_ID]
  • Set your default compute zone:
    gcloud config set compute/zone [COMPUTE_ZONE]
  • Update all gcloud commands to the latest version:
    gcloud components update

Viewing your clusters

gcloud

To view a specific cluster, run the following command:

gcloud container clusters describe [CLUSTER_NAME]

To view all clusters in your default zone:

gcloud container clusters list

Console

To view your clusters, visit the Kubernetes Engine menu in GCP Console.

Visit the Kubernetes Engine menu

To see more information about a cluster, select a cluster from the list.

Setting a default cluster for kubectl

If you have multiple clusters, you can set a default cluster for the kubectl command-line tool.

To learn more, refer to Setting a default cluster for kubectl commands.

Setting a default cluster for gcloud

gcloud

To set a default cluster for gcloud commands, run the following command:

gcloud config set container/cluster [CLUSTER_NAME]

Adding or removing zones

The following sections explain how to add or remove cluster zones.

Changing zones for zonal clusters

gcloud

To add or remove zones for a zonal cluster, use the gcloud container clusters update command:

gcloud container clusters update [CLUSTER_NAME] \
--zone [COMPUTE_ZONE] \
--node-locations [COMPUTE_ZONE,COMPUTE_ZONE,...]

where:

  • [CLUSTER_NAME] is the name you choose for the cluster
  • --zone [COMPUTE_ZONE] is the zone for the cluster control plane
  • --node-locations [COMPUTE_ZONE,COMPUTE_ZONE,...] is all of the desired zones. Include the cluster control plane's zone.

For example, example-cluster runs in us-central1-a. To add two more zones to the cluster, you'd run the following command:

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

As another example, example-cluster runs in us-central1-a, us-central1-b and us-central1-c. If you only want the cluster to run in us-central1-a and us-central1-b, you'd run the following command:

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

Console

To add or remove zones in an existing cluster, perform the following steps:

  1. Visit the Kubernetes Engine menu in GCP Console.

    Visit the Kubernetes Engine menu

  2. Select the desired cluster, then click Edit.

  3. From the Additional zones section, select some or all of the desired zones.
  4. Click Save.

Changing zones for regional clusters

gcloud

To add or remove zones for a regional cluster, use the gcloud container clusters update command with the --region flag:

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

where:

  • [CLUSTER_NAME] is the name of the cluster.
  • --region [REGION] is the region in which the cluster runs.
  • --node-locations [COMPUTE_ZONE,COMPUTE_ZONE,...] is all of the desired zones.

For example, example-cluster runs in us-central1-a and us-central1-b. To add us-central1-c, you'd run the following command:

gcloud container clusters update example-cluster \
--region us-central1 \
--node-locations us-central1-a,us-central1-b,us-central1-c

As another example, example-cluster runs in us-central1-a, us-central1-b and us-central1-c. If you only want the cluster to run in us-central1-a and us-central1-b, you'd run the following command:

gcloud container clusters update example-cluster \
--region us-central1 \
--node-locations us-central1-a,us-central1-b

What's next

Was this page helpful? Let us know how we did:

Send feedback about...

Kubernetes Engine