astefanutti / kubebox

⎈❏ Terminal and Web console for Kubernetes
http://astefanutti.github.io/kubebox
MIT License
2.16k stars 140 forks source link

View and select context similar to kubectl config get-contexts / use-context #38

Open t0meck opened 5 years ago

t0meck commented 5 years ago

Hello

Great tool. The only thing I miss is to be able to switch contexts in a way similar to how namespaces are selected. In README.md it is mentioned that there is interactive switching of contexts but I haven't found out how to do this.

It's just that I'm tired of constantly entering "kubectl config use-context" when I have to switch between clusters. I planned to write myself a script written in "dialog" to present a list of contexts and select one of them but then I found out your tool. It's great but I still miss this function in it.

If possible please add it.

Kind regards Tom

astefanutti commented 5 years ago

Hi thanks for the feedback.

We've have somehow divided the context management in two separate dialog:

Let us know if the dialog open with the l key meets your need. Otherwise, it may be useful to have a dialog closer the what kubectl config get-contexts outputs.

t0meck commented 5 years ago

Nope. When I press "l" (lowercase L) i get a dialog which shows login instead of list of contexts. I use AKS (Azure Kubernetes Services) and config is put there by "az aks get-credentials -n AKS_NAME -g AKS_RESOURCE_GROUP" so I don't operate usually on tokens etc...

I mean: kubectl config get-contexts -o name Can output of above command be put in a box like switching between namespaces is organized? Or if not possible to call different command then above command just read ~/.kube/config which is written in yaml format and just extract:

astefanutti commented 5 years ago

Actually, from the login dialog (open by pressing the l key), you can browse and switch context using the left and right arrow keys. I plan to make that more obvious from the UI, and provide more fields for the contexts in addition to username / password / token.

I'm not familiar with AKS, but if it uses the az aks get-credentials command as exec field from the user Kube config to retrieve the token, this is something that has yet to be supported by Kubebox as in #32.

t0meck commented 5 years ago

No. az aks get-credentials will connect to azure and download from it credentials which are needed to connect to cluster. It will also append them to kube/config automatically. So what is only required is just to read the kube/config file and use credentials stored there.

astefanutti commented 5 years ago

Then, you should be able to find the corresponding context in the login widget with the left and right arrow keys.

t0meck commented 5 years ago

Ok. They're there. Thx. But even then if possible, selecting connection from list like namespaces are shown is much more convenient.

astefanutti commented 5 years ago

Yes, I agree it's not very convenient, especially as the number of contexts increases. We need to improve the UI for browsing / switching contexts. Thanks for the feedback.

t0meck commented 5 years ago

If contents for this window is provided from kube/config then rewriting it to show list with names and urls to cluster along with +/- buttons which would then literally add or remove configs to/from kube/config would be enough I suppose.

I wish my skill in node was higher so I could help here...

astefanutti commented 5 years ago

Yes, the content of the login widget is sourced from the kubeconfig file. It's just a matter of improving the UI.