Creating an Autopilot cluster at a specific version

< 1 min read

Sometimes you may wish to create a GKE Autopilot cluster with a specific version. For example, the big news this week is that mutating webhooks are finally supported in Autopilot (from version 1.21.3-gke.900). While you will likely need to wait a bit for this to hit the Regular release channel for production stability, if you have a workload blocked then you might want to try it out now and get it ready.

Through the UI, you can choose the 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 “rapid” than Rapid by specifying the version. Today, this has to be done on the command line.

Here’s how:

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

$ gcloud container get-server-config --flatten="channels" \
      --filter="" \
      --format="yaml(,channels.validVersions)" \
      --region "us-west1"

Fetching server config for us-central1-b
  channel: RAPID
  - 1.21.3-gke.900
  - 1.21.3-gke.100
  - 1.20.9-gke.700
  - 1.20.8-gke.900

As we can see, the version I’m looking for 1.21.3-gke.900 is available. This patch release won’t be around forever, so you can equally look for a more recent one in that list to use.

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

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