I regularly have to create new Google Kubernetes Engine (GKE) clusters (via Google Cloud Shell). I use the bash snippets below to do so.
export PROJECT_ID=$GOOGLE_CLOUD_PROJECT
export CLUSTER_NAME=my-cluster-5
export KUBECONTEXT_NAME=my-cluster-5
export ZONE=us-central1-b
export NUM_OF_NODES=2
gcloud container clusters create ${CLUSTER_NAME} \
--project=${PROJECT_ID} --zone=${ZONE} \
--machine-type=e2-standard-4 --num-nodes=${NUM_OF_NODES}
kubectx ${CLUSTER_NAME}=gke_${PROJECT_ID}_${ZONE}_${CLUSTER_NAME}
1. Delete cluster using the console/UI.
kubectx -d ${CLUSTER_NAME}