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

kubie ctx needs cluster admin role #45

Closed
nextsux opened this issue Jun 23, 2020 · 4 comments
Closed

kubie ctx needs cluster admin role #45

nextsux opened this issue Jun 23, 2020 · 4 comments

Comments

@nextsux
Copy link

nextsux commented Jun 23, 2020

It's unable to enter context which is scopet only to one namespace:

kubie ctx gitlab@cluster
Error: Error calling kubectl: Error from server (Forbidden): namespaces is forbidden: User "system:serviceaccount:klum:gitlab cannot list resource "namespaces" in API group "" at the cluster scope

where gitlab@cluster has role like this:

rules:
- apiGroups:
  - ""
  - extensions
  - apps
  resources:
  - '*'
  verbs:
  - '*'
- apiGroups:
  - batch
  resources:
  - jobs
  - cronjobs
  verbs:
  - '*'
@sbstp
Copy link
Owner

sbstp commented Jun 24, 2020

Hmm I didn't think of this use case. I use kubectl get namespaces to verify that the namespaces are valid. In this case the user cannot list namespaces. I could turn the namespace error into a warning such as Warning: could not verify if namespace exists when you enter a namespace or context.

If there's a way of verifying if a user has access to a namespace without listing them it could work also, but I'm not aware of such a feature.

@nextsux
Copy link
Author

nextsux commented Jun 24, 2020

Oh I see, I was wondering why you need that. I do not know about about other way either. But I think warning should be enough.

@mory91
Copy link

mory91 commented Oct 1, 2020

For example in our company, different teams have access to certain namespaces and there are a few people who have access to the whole cluster.
To implement this, we can do kubectl get namespace sample-ns and if this doesn't return error we know the user has access to the namespace.

@sbstp
Copy link
Owner

sbstp commented Feb 14, 2021

Hey, I think #60 will help with this. You can disable namespace checking completely.

@sbstp sbstp closed this as completed Feb 19, 2021
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