Upgrade GKE Control Plane

This section will walk you through the steps required to upgrade the control plane of a GKE cluster.

What You’ll Need

Check Your Environment

Before you start upgrading the GKE control plane, follow the next steps to ensure that your environment meets the requirements:

  1. Get the Kubernetes version of your cluster control plane by inspecting the Server Version in the following command:

    root@rok-tools:~# kubectl version --short Client Version: v1.23.17 Server Version: v1.22.15-gke.100
  2. Get the Kubernetes version of your nodes:

    root@rok-tools:~# kubectl get nodes -o json | \ > jq -r '.items[].status.nodeInfo.kubeletVersion' v1.22.15-gke.100 v1.22.15-gke.100
  3. Verify that the Kubernetes minor version of your nodes found in step 2 is the same as the control plane’s current minor version found in step 1. Otherwise, first update your node pool to the control plane’s current version and return to follow this guide.

    Note

    For example, if your control plane is running version 1.22 and any of your nodes are running a version behind, update your nodes to version 1.22 before updating your control plane’s Kubernetes version to 1.23.

  4. Get the Rok version running in your GKE cluster:

    root@rok-tools:~# kubectl get -n rok rokcluster rok -o json | \ > jq -r '.status.version' release-2.0-l0-release-2.0.2
  5. Ensure that the version you found matches the latest Rok version release-2.0-l0-release-2.0.2. Otherwise, first upgrade your Rok cluster to the latest Rok version and return to follow this guide.

Procedure

  1. Specify your GKE cluster:

    root@rok-tools:~# export GKE_CLUSTER=<GKE_CLUSTER>

    Replace <GKE_CLUSTER> with the name of your GKE cluster, for example:

    root@rok-tools:~# export GKE_CLUSTER=arrikto-cluster
  2. Specify the new Kubernetes version. Choose one of the following options, based on the Kubernetes version you want to upgrade to:

    root@rok-tools:~# export CLUSTER_VERSION=1.23
    root@rok-tools:~# export CLUSTER_VERSION=1.22
  3. Upgrade the control plane of your GKE cluster to the new Kubernetes version:

    root@rok-tools:~# gcloud container clusters upgrade ${GKE_CLUSTER?} \ > --master \ > --cluster-version ${CLUSTER_VERSION?} Upcoming breaking change: Starting with v1.23, Kubernetes has removed several v1beta1 APIs for more stable v1 APIs. Read more about this change - https://cloud.google.com/kubernetes-engine/docs/deprecations/apis-1-22. Please ensure that your cluster is not using any deprecated v1beta1 APIs prior to upgrading to GKE 1.23. Master of cluster [arrikto-cluster] will be upgraded from version [1.22] to version [1.23]. This operation is long-running and will block other operations on the cluster (including delete) until it has run to completion. Do you want to continue (Y/n)? Y Upgrading arrikto-cluster...done. Updated [https://container.googleapis.com/v1/projects/myproject/zones/us-east1-b/clusters/arrikto-cluster].

    Note

    You can update only one minor version at a time. Therefore, if you want to update to 1.23 and your current version is two versions behind, then you must first update your cluster to 1.22 and then update it from 1.22 to 1.23.

Verify

  1. Ensure that the status of your GKE cluster is RUNNING:

    root@rok-tools:~# gcloud container clusters describe ${GKE_CLUSTER?} \ > --format "value(status)" RUNNING
  2. Get the Kubernetes version of your cluster control plane by inspecting the Server Version in the following command and ensure that it matches the new Kubernetes version. Choose one of the following options, based on the upgrade you’ve made:

    root@rok-tools:~# kubectl version --short Client Version: v1.23.17 Server Version: v1.23.11-gke.300
    root@rok-tools:~# kubectl version --short Client Version: v1.23.17 Server Version: v1.22.15-gke.100

Summary

You have successfully upgraded the control plane of your GKE cluster.

What’s Next

The next step is to upgrade the node pool of your GKE cluster.