Google cloud configs

Download and install gcloud

Simply follow this link

Listing existing configurations

gcloud config configurations list

NAME     IS_ACTIVE  ACCOUNT                         PROJECT          DEFAULT_ZONE       DEFAULT_REGION

This should give you only one line, with a default account.

Creating a configuration

gcloud config configurations create testconf

This will guide you through the configuration of a new configuration. It allows you to set one config per account, project, cluster…

Activating a configuration

gcloud config configurations activate testconf

As simple as this to change your account/config.

Kubernetes cluster contexts

On linux, all kubernetes configs are stored in ~/.kube/config. Each config is used via a context.

Listing contexts

kc config get-contexts

will give you the list of available contexts.

Creating a context

config set-context testconf

You will probably also need to get your cluster credentials

gcloud container clusters get-credentials clustername

Activating a context

config use-context testconf

Switching between projects with gcloud configs and kubernetes contexts

Once all the necessary configs and contexts were created, to switch from a cluster to another:

gcloud config configurations activate testconf
kubectl config use-context testconf