Created
June 20, 2019 16:23
-
-
Save JoelPM/f921408ab3dd15492f443ddabe2ffc74 to your computer and use it in GitHub Desktop.
A small script for getting cluster credentials for all GKE clusters in the given GCP projects.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/sh | |
# Usage: ./get_all_gcp_cluster_creds.sh PROJECT1 [PROJECT2 ...] | |
for project in "$@" | |
do | |
echo "Getting cluster credentials for project $project" | |
gcloud container clusters list --project $project --format="table[no-heading](name,location)" | while read cluster location | |
do | |
gcloud container clusters get-credentials $cluster --project $project --region $location | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment