You can manage the order of automatic cluster upgrades across Google Kubernetes Engine (GKE) clusters in multiple environments using rollout sequencing. For example, you can qualify a new version in pre-production clusters before upgrading production clusters.
When GKE upgrades a cluster, first the control plane is upgraded, then the nodes are upgraded. In a rollout sequence, clusters are still upgraded using this process, but you also control the order in which groups (fleets or scopes) of clusters are upgraded, and you specify a soak time to choose for how long GKE pauses before upgrades proceed from one group to the next group.
In this lab, you learn how to create and configure rollout sequences using fleets.You also learn how to define soak time to control upgrade rollout speed and monitor and verify upgrades across different environments.
Before you click the Start Lab button:
To complete this lab, you need:
Note: If you already have your own personal Google Cloud account or project, do not use it for this lab.
Note: If you are using a Pixelbook, open an Incognito window to run this lab.
After a few moments, the Cloud Console opens in this tab.
Cloud Shell is a virtual machine that is loaded with development tools. It offers a persistent 5GB home directory and runs on the Google Cloud. Cloud Shell provides command-line access to your Google Cloud resources.
In the Cloud Console, in the top right toolbar, click the Activate Cloud Shell button.Click Continue.
It takes a few moments to provision and connect to the environment. When you are connected, you are already authenticated, and the project is set to your PROJECT_ID. For example:
gcloud is the command-line tool for Google Cloud. It comes pre-installed on Cloud Shell and supports tab-completion.
You can list the active account name with this command:
gcloud auth list
(Output)
Credentialed accounts: - <myaccount>@<mydomain>.com (active)
(Example output)
Credentialed accounts: - google1623327_student@qwiklabs.net
You can list the project ID with this command:
gcloud config list project
(Output)
[core] project = <project_ID>
(Example output)
[core] project = qwiklabs-gcp-44776a13dea667a6
For full documentation of gcloud see the gcloud command-line tool overview.
gcloud container clusters create-auto CLUSTER_NAME \ --location=LOCATION \ --project=PROJECT_ID --enable-fleet
Replace the following:
gcloud container clusters update CLUSTER_NAME --enable-fleet
Replace the following:
gcloud services enable \ --project=FLEET_HOST_PROJECT_ID \ container.googleapis.com \ gkeconnect.googleapis.com \ gkehub.googleapis.com \ cloudresourcemanager.googleapis.com \ iam.googleapis.com
gcloud projects add-iam-policy-binding FLEET_HOST_PROJECT_ID \ --member user:GCP_EMAIL_ADDRESS \ --role=roles/owner
Replace the following:
FLEET_HOST_PROJECT_ID
: with the ID of the first fleet's host project.gcloud projects add-iam-policy-binding FLEET_HOST_PROJECT_ID \ --member user:GCP_EMAIL_ADDRESS \ --role=roles/container.admin
Replace the following:
FLEET_HOST_PROJECT_ID
: with the ID of the first fleet's host project.Create a rollout sequence:
gcloud container fleet clusterupgrade update \ --default-upgrade-soaking=SOAK_TIME \ --project=FIRST_FLEET_PROJECT_ID
Replace [**] with the project ID of the fleet host project.
Set the upstream fleet and the soak time for the second fleet in the sequence:
gcloud container fleet clusterupgrade update \ --upstream-fleet=FIRST_FLEET_PROJECT_ID \ --default-upgrade-soaking=SOAK_TIME \ --project=SECOND_FLEET_PROJECT_ID
Replace [**] with the project ID of the first fleet's host project, and [**] with the project ID of the fleet host project.
On this page, you can view the rollout sequence associated with your project's fleet. You can do the following to see the progress of a rollout sequence:
You can visually monitor your entire rollout sequence while GKE upgrades all the clusters in the sequence, qualifying a new version across environments before upgrading your production environment clusters. While monitoring, you can manage a rollout sequence with the gcloud CLI, making any changes as needed.
Use these commands in the following sections to check on how upgrades are progressing in a rollout sequence. To learn more about what details are provided, see Status information for a rollout sequence
To run these commands, ensure that you have the required permissions for each fleet host project. For example, if the sequence has cross-project scopes in different fleets, you need permissions in each project to describe the sequence.
For the following commands, if you only need information about one fleet or scope in the sequence, replace the --show-linked-cluster-upgrade
flag with --show-cluster-upgrade
.
Check the status of a fleet-based rollout sequence:
gcloud container fleet clusterupgrade describe \ --show-linked-cluster-upgrade --project=FLEET_PROJECT_ID
Replace [**] with the project ID of the host project for any fleet in the sequence.