harbur / kubernetic

Kubernetic - Supercharge your Kubernetes clusters
https://kubernetic.com
276 stars 26 forks source link

Doesn't function if kubectl get ns and --all-namespaces aren't allowed #31

Closed GJKrupa closed 6 years ago

GJKrupa commented 7 years ago

Working in a secured environment where users are granted access to specific namespaces rather than having full admin access doesn't work - no data at all is displayed. It would be very useful in such circumstances to be able to specify a list of known namespaces instead of relying on the API to interrogate this data.

dkapanidis commented 7 years ago

Hi,

probably the issue here is not being able to authenticate properly. RBAC-enabled environments are not yet tested, it is in the backlog at the moment.

What does the API return for namespaces (by kubectl get namespaces -o yaml), is it a complete list or a reduced view (I suspect the first from what you say). And how would you foresee the list of known namespaces be populated?

I would expect Kubernetes itself to be able to provide the information. Maybe we can ask the RBAC list, if the user has privileges for that namespace.

dkapanidis commented 7 years ago

ok, I just noticed the title, if the list of namespaces is not accessible by RBAC, then the namespace could be added in the .kubecfg and it can be picked up automatically (currently it doesn't pick it yet). Would that solve your use-case? For multiple namespaces, multiple contexts can be defined in .kubecfg and switch between them.

GJKrupa commented 7 years ago

That would suit me perfectly. That's how I define my contexts anyway to avoid having to add the -n flag every time I run kubectl.

dkapanidis commented 6 years ago

New version of Kubernetic (v2.0.13) now supports RBAC connection. The only necessary privilege is to be able to watch for the resources.

As for the namespace, now the context's namespace is respected, and shown on the namespace dropdown even if privileges cannot allow to view it resolving the issue.

Also added compatibility with kubectx and kubens cli commands (https://github.com/ahmetb/kubectx). Kube config is monitored for changes and when context or namespace is changed Kubernetic switches to the new environment.

GJKrupa commented 6 years ago

Works like a charm. Thanks very much.