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. Autopilot mode is basically a fully managed kind of a setup. With standard mode, we get fully managed control plane. But we need to plan for the capacity of data plane nodes & create, manage them accordingly. With autopilot mode, even data plane is also fully managed. There is no need to explicitly create the computing instances or manage them. That is taken care by Google Cloud. GCP will derive the resources required from the pod specification in k8s deployment configuration file. They will allocate nodes accordingly & run our workloads.

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 had to pass region manually in the shell command & after that cluster creation command worked.

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

Ideally the last command should not have been required as default region was already entered as part of gcloud config commands. GCP should have used the same value. Anyways, if you are facing the same issue, this is a workaround which actually works. This should unblock you & you should be able to create GKE cluster in autopilot mode.

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

Leave a Reply to Devinda Senanayake Cancel reply