# macOS
brew install google-cloud-sdk
# verify
gcloud versiongcloud components install gke-gcloud-auth-plugin --quiet
# verify
gke-gcloud-auth-plugin --versionbrew install kubectlgcloud auth login
gcloud auth application-default login --project=<PROJECT_ID>gcloud container clusters get-credentials <CLUSTER_NAME> \
--region=<REGION> \
--project=<PROJECT_ID>Example with the test cluster:
gcloud container clusters get-credentials n-gke-test-01 \
--region=us-central1 \
--project=nuon-gcp-supportkubectl cluster-info
kubectl get namespaces
kubectl get nodesNote: GKE Autopilot clusters show no nodes until pods are scheduled.
gke-gcloud-auth-plugin not found
gcloud components install gke-gcloud-auth-plugin --quietIf installed via brew instead of gcloud installer:
export USE_GKE_GCLOUD_AUTH_PLUGIN=TrueUnable to connect to the server
Check that cluster_endpoint_public_access = true in the terraform config, or that your IP is in master_authorized_networks.
Forbidden errors
Your Google account needs IAM permissions on the project. Ask for roles/container.developer or roles/container.admin on the GCP project.