1

I have a problem with Google cloud console and kubernates

i have two projects:

$ gcloud projects list
PROJECT_ID      NAME           PROJECT_NUMBER
telemetry       Telemetry      571056202575
opex-prod       OPEX           992345650242

If I check current project:

$ gcloud config get-value project
Your active configuration is: [cloudshell-20766]
telemetry

and list of my namespaces (i will show only my namespace, not default and kube* ones):

$ kubectl get namespace
NAME              STATUS   AGE
development       Active   3d18h

so, now if I want change project (which has different pods and namespaces):

$ gcloud config set project opex-prod
Updated property [core/project].
$ gcloud config get-value project
Your active configuration is: [cloudshell-20766]
opex-prod

but if i check the namespaces on opex-prox project i will have namespace of my other project

$ kubectl get namespace
NAME              STATUS   AGE
development       Active   3d18h

in opex-prod I don't have development but prod-a

If i change projects and namespaces in Google Cloud dashboard I can see correct namespaces

what i'm missing??

Ging3r
  • 2,010
  • 2
  • 17
  • 26

1 Answers1

2

kubectl commands don't work based on gcloud project config. They work based on kubeconfig set in your local environment. To set kubeconfig to point to a particular project's cluster, run gcloud container clusters get-credentials cluster-name command after you change your gcloud project config. Read here for more info.

dishant makwana
  • 1,029
  • 6
  • 13