GKE Autopilot Cluster Creation Failed With 400 Response “Autopilot clusters must be regional clusters.”

I was playing around with Google Kubernetes Engine few days back. I wanted to try out GKE autopilot cluster setup. I followed the steps mentioned in the docs & executed commands from Cloud Shell. I have setup default project id, zone & region before actually initiating GKE cluster creation process.

I ran the below three commands first:

gcloud config set project <PROJECT_ID>

gcloud config set compute/zone <COMPUTE_ZONE>

gcloud config set compute/region <COMPUTE_REGION>

Then I tried to create an autopilot GKE cluster by running below command:

gcloud container clusters create-auto hello-cluster

But it failed with below error message:

ERROR: (gcloud.container.clusters.create-auto) ResponseError: code=400, message=Autopilot clusters must be regional clusters.

I was kind of surprised as I already mentioned default region on which K8s cluster can be created. But somehow that value was not getting picked up in cluster creation command.

To solve this, I passed region manually in the shell command & it worked.

gcloud container clusters create-auto hello-cluster --region <COMPUTE_REGION>

Leave a Comment