3.2.1 Creating a cluster

View in the book. Buy the book.

Create Cluster

Create an Autopilot cluster in the UI

3.8 GKE Autopilot’s cluster creation UI
Figure 3.8 GKE Autopilot’s cluster creation UI

or via CLI:

CLUSTER_NAME=my-cluster
REGION=us-west1
gcloud container clusters create-auto $CLUSTER_NAME --region $REGION

Authenticate to the cluster

Copy the cluster connection command from the UI

3.9 GKE’s cluster connection UI
Figure 3.9 GKE’s cluster connection UI

Or CLI:

gcloud container clusters get-credentials $CLUSTER_NAME --region $REGION

Test your connection:

$ kubectl get pods
No resources found in default namespace.

Other Environments

If you’re not using Cloud Shell, you’ll need to configure gcloud.

Download gcloud: https://cloud.google.com/sdk/install

gcloud init
gcloud components install kubectl