Creating an Autopilot cluster at a specific version

2 min read

Sometimes you may wish to create or update a GKE Autopilot cluster with a specific version. For example, the big news this week is that mutating webhooks are supported in Autopilot (from version 1.21.3-gke.900). Rather than waiting for your desired version to be the default in your cluster’s release channel, you can update ahead of time.

Through the UI, you can choose the Autopilot release channel but each release channel actually has a few different versions. “Rapid” is the obvious release channel to use for testing new features, but you can be even more bleeding-edge than the default version in the Rapid channel by specifying the version.

Here’s how:

Firstly, you can view the list of available versions for each channel like so:

$ gcloud container get-server-config --region us-west1 \
    --format="yaml(channels)"

Fetching server config for us-west1
channels:
- channel: RAPID
  defaultVersion: 1.21.4-gke.2300
  validVersions:
  - 1.22.2-gke.1300
  - 1.21.3-gke.900
  - 1.21.5-gke.1300
  - 1.21.4-gke.2300
- channel: REGULAR
  defaultVersion: 1.20.10-gke.301
  validVersions:
  - 1.21.3-gke.2001
  - 1.20.10-gke.1600
  - 1.20.10-gke.301
  - 1.20.9-gke.1001
- channel: STABLE
  defaultVersion: 1.19.13-gke.1900
  validVersions:
  - 1.20.10-gke.1600
  - 1.20.10-gke.301
  - 1.19.14-gke.1900
  - 1.19.13-gke.1900

As we can see, the version I’m looking for 1.21.3-gke.900 is available. This version release won’t be around forever, so when you run this command, pick any valid version you want to try.

Now, specify both the channel and the version you desire:

VERSION="1.21.3-gke.900"
CHANNEL="rapid"
CLUSTER_NAME=test-cluster
REGION=us-west1
gcloud container clusters create-auto $CLUSTER_NAME \
    --release-channel $CHANNEL --region $REGION \
    --cluster-version $VERSION

For existing clusters, you can query their current version and release channel like so:

gcloud container clusters describe $CLUSTER_NAME \
    --region $REGION \
    --format="yaml(releaseChannel,currentMasterVersion)"

And upgrade them to any version available in that release channel (as discovered with the get-server-config command above), with the following:

VERSION="1.21.3-gke.900"
gcloud container clusters upgrade $CLUSTER_NAME \
    --region $REGION \
    --master --cluster-version $VERSION

For clusters on the Regular and Stable channels, you can even upgrade them to patch versions that are offered in Rapid for any minor version offered in your channel. For example, based on the get-server-config output above, we see that version 1.21.* is offered in Standard. That means you can pick any patch version starting with 1.21, even those only “officially” in the Rapid channel, for example 1.21.5-gke.1300. Before you can pick a patch version from another channel, your cluster must be running the minor version, so upgrade to one of the versions offered within the channel first if needed.

1 comment

Comments are closed.