Is there a way for a google cloud platform specific project for kubectl in a team?

Is there something like: kubectl get pods --project = PROJECT_ID

I would not want to change my default gcloud configuration to switch between my staging and working environment.

+5
source share
2 answers

kubectl saves clusters / contexts in its configuration. If you use the default scripts to invoke the cluster, these entries must be set for your clutser.

Short review of kubectl config :

You can use kubectl config use-context to change the default context, and kubectl --context=CONTEXT get pods to switch to another context for the current command.

+6
source

You can load credentials for each of your clusters using gcloud container clusters get-credentials , which accepts the --project flag. After the credentials are cached locally, you can use the --context flag (as Yu-Yu explains in his answer) to switch between clusters for each command.

+4
source

Source: https://habr.com/ru/post/1247223/


All Articles