The procedure doesn’t differ from the Cloud console procedure. The step we didn’t have in Cloud console is retrieving available versions. Proceed as follows:
- To retrieve available GKE versions, we need to run the following command:
gcloud container get-server-config –zone=zone_name
This results in the following output:
Figure 6.8 – Available GKE versions from different release channels
- We can upgrade the cluster to the standard version per our previously selected channel using the following command:
gcloud container clusters upgrade CLUSTER_NAME
–zone=zone_name–master - If we want to upgrade to a specific version, we can use the following command:
gcloud container clusters upgrade CLUSTER_NAME
–zone=zone_name
–master –cluster-version VERSION - In this case, we have a GKE cluster called gke-cluster-4 using a stable release channel. We will upgrade it from version 1.22.12-gke.2300 to the latest available—1.23.11-gke.300—and we will specify the cluster zone. If you want to upgrade to the latest version, it is possible to use the latest flag instead of the exact cluster version:
gcloud container clusters upgrade gke-cluster-4 –zone=europe-west4-c –master –cluster-version 1.23.11-gke.300
This results in the following output:
Figure 6.9 – Command to upgrade the GKE cluster to a specific version
- After a few minutes, the cluster upgrade is finished. We can check the cluster version by running the gcloud container clusters list –zone=europe-west4-c command, which results in the following output:
Figure 6.10 – The gke-cluster-4 cluster has been upgraded to a newer version
After successfully upgrading the cluster, our master GKE nodes have a new version, and the next step to complete the upgrade is to upgrade the node pool.
Now that we have a successful upgrade using the command line and Cloud console, we are ready to proceed with the next step in our learning—cluster removal.
A cluster removal operation is irreversible, and all the resources within the cluster will be removed. This includes the following:
- Control plane resources
- All node instances in the cluster
- Any Pods that are running on those instances
- Any firewalls and routes created by GKE at the time of cluster creation
- Data stored in the hostPath host and emptyDir volumes
Cloud console
In Cloud console, choose the to-be-deleted cluster by selecting the three dots, as shown in the following screenshot:
Figure 6.11 – GKE cluster deletion in Cloud console
We need to confirm cluster deletion by typing the name of the cluster, as follows:
Figure 6.12 – Cluster deletion confirmation
Once the DELETE button is pressed, the cluster will no longer be accessible. After a moment, deletion completes, and the cluster with its resources no longer exists.