-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GKE: Error 403: The caller does not have permission, forbidden #14
Comments
In GKE, owner does not grant full permissions inside the kubernetes cluster. My guess is that you need to grant your user a clusterrolebinding with higher privileges. This stack overflow does a decent job of describing the process: |
Thank you @sudermanjr, but I get the same error even with the cluster-admin clusterrolebinding assigned to my user:
|
Ah, the issue is not the account used to start the cluster, it's the account you are using when you run rbac-lookup and the permissions that it has in your GCP account. Basically, you need to be able to run some form of |
Thank you, but I am using the same account to create the cluster and also to run rbac-lookup (my user is the owner of the project and I am creating a cluster-admin role for it):
|
Hey @ryepesg, thanks for reporting this problem! I think the confusion here is that you actually need GCP IAM access here, not just GCP cluster access. Even a GKE cluster admin might not actually have project IAM access. There's 3 calls this could be happening on, to help me rule out one of them, can you try to run this command?
If that works for you, that rules out a problem with https://github.com/reactiveops/rbac-lookup/blob/master/lookup/lister.go#L198. On the other hand, if it doesn't you'll need more IAM access for your account. Either way, there are a couple places above that in that method that could also trigger an error like that. I'll work on adding some better error handling so we can tell which of those actually triggered the error, as well as changing the initial scope request to be read only. Thanks again for all the help debugging this! |
Thank you @robscott, I am the owner of the project in IAM and I am also a cluster-admin of the cluster. Here is the output of the command:
Thank you, |
@ryepesg I've released a new version of rbac-lookup with one potential fix, along with some more helpful error messages. Let me know if that helps narrow down the problem. Thanks again for all the help! |
Thank you. Here is my new attempt using a service account:
|
Hey @ryepesg, thanks for all that output! My best guess here is that the logic for parsing the GCP project ID here was not functioning here. When you use the gcloud CLI to get GKE credentials, it generally initializes a cluster with a name following this pattern:
I split that by underscores, and the 2nd element in the resulting array generally represents the GCP project name. In your case that computed to
In both cases, if there is a value found, it will attempt to use it to load an IAM policy, and if that fails, it will move on to the next one. Hopefully this helps, thanks for all the detailed feedback! |
Thanks for the answer. This my new run:
Using a different project, with a different user:
However, the |
@ryepesg Somehow I just realized I was likely going down the wrong, much more complicated path here. What happens if you run |
Thank you @robscott! That was the problem indeed. I even tested changing the account with So, the correct way to change the account is:
That works even after using Thanks for all the help, cheers, |
Nice! Glad that solved it. I'll work on updating the docs to be more helpful here. Thanks for all your help working through this! |
Trying to run rbac-lookup with the
--gke
flag produces:Error loading RBAC Bindings: googleapi: Error 403: The caller does not have permission, forbidden
The problem happens with multiples configurations of clusters:
The problem occurs even using a service account with the Owner role:
The text was updated successfully, but these errors were encountered: