GCP: list of available GKE cluster versions in region and channel

If you are going to create a GKE cluster in a region, you may need to be explicit with the version of the master control plane and worker nodes.  Below is how you would list the available versions.

# specify your region
region=us-east1
gcloud container get-server-config --region=$region

The available release channels are RAPID, REGULAR, STABLE, and no channel.

To see the available versions without a channel:

# avail control plane versions
gcloud container get-server-config --format="yaml(validMasterVersions)" --region=$region

# avail node pool versions
gcloud container get-server-config --format="yaml(validNodeVersions)" --region=$region

To see the available versions in the STABLE channel.

# avail control plane versions
gcloud container get-server-config --flatten="channels" --filter="channels.channel=STABLE" --format="yaml(channels.channel,channels.defaultVersion)" --region=$region

# avail node pool versions
gcloud container get-server-config --flatten="channels" --filter="channels.channel=STABLE" --format="yaml(channels.channel,channels.validVersions)" --region=$region

 

REFERENCES

google ref, container versions available

google ref, meaning of channels

stackoverflow.com, answers about ways to list GKE container versions

NOTES

format can also be returned as json

gcloud container get-server-config --region=$region --format=json

flattening results as described by laylos

gcloud container get-server-config \
      --region=$region \
      --flatten=channels \
      --filter="channels.channel=REGULAR" \
      --format="value(channels.defaultVersion)"