Skip to content
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

Cannot run with viewer role #9

Open
tjun opened this issue Jan 3, 2020 · 4 comments
Open

Cannot run with viewer role #9

tjun opened this issue Jan 3, 2020 · 4 comments

Comments

@tjun
Copy link

tjun commented Jan 3, 2020

In querying APIs, failed to list secret and cannot show the result.

When I try to run kubectl tree with viewer role, got the following error:

Error: error while querying api objects: listing resources failed (/v1, Resource=secrets): 
secrets is forbidden: User "[email protected]" cannot list resource "secrets" in API group "" at the cluster scope: Required "container.secrets.list" permission.
@hasheddan
Copy link

Hi @tjun! I believe this could be solved by just updating your role to have list permissions on Secret objects. Do you have permissions in you cluster to modify RBAC?

@ahmetb
Copy link
Owner

ahmetb commented Jan 3, 2020

I think we’re talking about GKE Viewer role here. Have you tried “viewer” role in Kubernetes rbac?

I suspect GKE Viewer doesn’t let the subject to view Secrets in a cluster, for a good reason.

@tjun
Copy link
Author

tjun commented Jan 4, 2020

Thanks!

Have you tried “viewer” role in Kubernetes rbac?

Yes, I already have a viewer role in Kubernetes rbac for the target namespace. Doesn't have cluster level viewer role.
I think kubectl-tree try to fetch Secrets on other namespace(default)?

@ahmetb
Copy link
Owner

ahmetb commented Jan 5, 2020

Kubectl tree tries to retrieve every single API resource in your cluster.

In the future we might introduce an --ignore-inaccessible option (and log those failures as warnings), but for now we flat out fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants