#!/usr/bin/env bash # # This script aims to reduce the amount of time you have to spend in # the GCP console by allowing you to search through the current # project's k8s clusters and select one to add it to your kubeconfig # and make it active. You can use kubectx to do the same thing for # clusters you already have in your kubeconfig but this goes to gcloud # and finds them for you. Must have gcloud and fzf installed. Kubectx # is also a third party utility you can install that is much faster # than dialing out to gcloud if you have already done that before. gcloud container clusters list 2>/dev/null | \ tail -n+2 | \ awk '{print $1, "\t", $2}' | \ fzf | \ awk '{print "gcloud container clusters get-credentials", $1, "--zone ", $2}' | \ sh -s