GKE store: no projects found in Google Cloud
Zebradil opened this issue · 9 comments
Prerequisites:
# ~/.kube/switch-config.yaml
kind: SwitchConfig
version: "v1alpha1"
kubeconfigStores:
- kind: gke
id: gke
config:
authentication:
authenticationType: gcloud
# optionally limit to certain projects in account
# projectIDs: []
Steps to reproduce:
- Run
switch
(Google Cloud Authorization opens in a web browser) - Allow access
- Wait a little bit, then exit from
switch
Result:
$ switch
WARN[0021] Supressed warnings during the search: 1 error occurred:
* store "gke.gke" returned an error during the search: failed to initialize store: no projects found in Google Cloud. Unable to discover GKE clusters
Error: abort
Expected
A list of GKE clusters. There are definitely some projects:
$ gcloud projects list | wc -l
5
And some GKE clusters:
$ gcloud container clusters list | wc -l
2
Additional information
Kubeswitch version info:
Switch:
version : v0.7.2
build date : 2022-09-20
go version : go1.19
go compiler : gc
platform : linux/amd64
Gcloud version info:
Google Cloud SDK 404.0.0
alpha 2022.09.23
beta 2022.09.23
bq 2.0.78
bundled-python3-unix 3.9.12
core 2022.09.23
gcloud-crc32c 1.0.0
gke-gcloud-auth-plugin 0.4.0
gsutil 5.14
Did you get it to work? I have the same issues
I also have to authenicate every time against Google when calling switch.
And I have no idea what a gcp store is and what ID is meant by that description: id: id-only-required-if-there-are-more-than-one-store
Ok, got it to working. Specific API has not been enabled. You can trigger this by executing
gcloud projects list
API [cloudresourcemanager.googleapis.com] not enabled on project. Would you like to enable and retry (this will take a few minutes)? (y/N)? y
After that, it just works :-)
Closed as seems to be a user issue.
@danielfoehrKn it is not a user issue. The issue @dfineSvenFlock had was something different. The original problem is still reproducible.
@Zebradil do you use multiple gcloud configurations and is gke enabled / are there gke clusters in your default config?
had the same, solved this by setting my default gcloud profile to a project that has a gke cluster. Wouldn't really call it a bug, but a "nice to be documented" or improvement kind of thing
@Zebradil do you use multiple gcloud configurations and is gke enabled / are there gke clusters in your default config?
No, I always used a single account. I'm not sure what you mean by "gke clusters in the default config", but there is nothing apart from my account email.
Setting a default project is not an option, as I don't have one that can be set as a default.
My solution to this issue was to stop using the gke store completely. Instead I use another tool to generate kubeconfigs for all GKE clusters I have access to and use kubeswitch just to switch contexts from the filesystem store.