This page shows you how to manage your clusters in Google Kubernetes Engine (GKE). To learn about how clusters work, refer to Cluster architecture.
Before you beginBefore you start, make sure that you have performed the following tasks:
gcloud components update
. Note: For existing gcloud CLI installations, make sure to set the compute/region
property. If you use primarily zonal clusters, set the compute/zone
instead. By setting a default location, you can avoid errors in the gcloud CLI like the following: One of [--zone, --region] must be supplied: Please specify location
. You might need to specify the location in certain commands if the location of your cluster differs from the default that you set.To view a specific cluster, run the following command:
gcloud container clusters describe CLUSTER_NAME
Replace CLUSTER_NAME
with the name of your cluster.
To view all clusters in your default zone:
gcloud container clusters list
Console
To view your clusters, go to the Google Kubernetes Engine page in the Google Cloud console.
Go to Google Kubernetes Engine
To see more information about a cluster, select the cluster from the list.
Setting a default cluster forkubectl
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.
gcloud
To set a default cluster for gcloud
commands, run the following command:
gcloud config set container/cluster CLUSTER_NAME
Replace CLUSTER_NAME
with the name of your cluster.
By default, GKE automatically upgrades your clusters. However, you can choose to upgrade your Standard clusters yourself. To learn more, see Manually upgrading a cluster.
For guidance on upgrading clusters, see Best practices for upgrading clusters.
Adding or removing zones in a Standard clusterThe following sections explain how to add or remove cluster zones. All zones must be in the cluster's region.
Warning: If you change the cluster zones, nodes are immediately added or removed. Before you remove a zone, ensure that your workloads in that zone are prepared for disruption. Changing zones for zonal clustersFor existing zonal clusters, you can add or remove zones.
gcloudTo add or remove zones for a zonal cluster, use the gcloud container clusters update
command:
gcloud container clusters update CLUSTER_NAME \
--location CONTROL_PLANE_LOCATION \
--node-locations COMPUTE_ZONE1,COMPUTE_ZONE2
Replace the following:
CLUSTER_NAME
: the name you choose for the cluster.CONTROL_PLANE_LOCATION
: the Compute Engine zone of the control plane of your cluster.COMPUTE_ZONE1,COMPUTE_ZONE2,[...]
: 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 --location
flag. For zonal clusters, --node-locations
must contain the cluster's primary zone.--node-locations
, do not put spaces between the zone names.
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 \
--location 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 \
--location 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:
Go to the Google Kubernetes Engine page in the Google Cloud console.
Beside the cluster you want to edit, click more_vert Actions, then click edit Edit.
Under the Details tab, for the Default node zones field, click edit Edit node pools.
Select the desired zones and save your changes.
Currently, it is only possible to change the zones for existing regional clusters using the gcloud
command.
To add or remove zones for a regional cluster, use the gcloud container clusters update
command with the --node-locations
flag:
gcloud container clusters update CLUSTER_NAME \
--location CONTROL_PLANE_LOCATION \
--node-locations COMPUTE_ZONE1,COMPUTE_ZONE2
Replace the following:
CLUSTER_NAME
: the name of the cluster.CONTROL_PLANE_LOCATION
: the Compute Engine region of the control plane of your cluster.COMPUTE_ZONE1
,COMPUTE_ZONE2,[...]
: the zones control plane region in which the nodes are created. The zones must be in the same CONTROL_PLANE_LOCATION
as the cluster's control plane(s), specified by the --location
flag.--node-locations
, do not put spaces between the 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 \
--location 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 \
--location us-central1 \
--node-locations us-central1-a,us-central1-b
Resizing clusters
You can resize a Standard cluster to increase or decrease the number of nodes it has. For example, if you want to stop your cluster from consuming resources without deleting it, you can scale the nodes down to zero. To learn more about resizing, see Resizing a cluster.
Autopilot clusters are sized automatically based on your Pod specifications, so resizing your cluster isn't something you need to worry about. For example, if you change the number of replicas of your Pod, or the resources it requests, the cluster will be sized up or down appropriately.
If you would like a more efficient way to optimize your clusters, you can also use Vertical Pod Autoscaling (VPA). The autoscaler can recommend values for CPU and memory requests and limits, or it can automatically update the values.
Deleting clustersWhen needed, you can delete a cluster. To learn more, see Deleting a cluster.
Adding clusters to a fleetIf your organization uses multiple clusters, you can simplify multi-cluster management by adding the clusters to a fleet: a logical grouping of Kubernetes clusters. Creating a fleet helps your organization uplevel management from individual clusters to entire groups of clusters, and lets you use fleet-enabled features such as Multi Cluster Ingress, Config Sync, and Policy Controller.
You can add GKE clusters to a fleet by using the Google Cloud console, gcloud CLI, or declaratively using Terraform or Config Connector.
You can learn more about how fleets work in Fleet management, and about creating fleets in Create fleets to simplify multi-cluster management.
What's nextRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4