ahmetb / kubectx

Faster way to switch between clusters and namespaces in kubectl
https://kubectx.dev
Apache License 2.0
17.71k stars 1.26k forks source link

Does it make sense to add kubecl? #52

Closed gmiroshnykov closed 6 years ago

gmiroshnykov commented 6 years ago

This might be a bit too philosophical, but here it goes.

In kubeconfig, Context is a thing that binds together Cluster, User and Namespace.

We have a kubectx command that mutates global current-context in kubeconfig. We also have a kubens command that mutates namespace inside the current Context.

So why don't we have a kubecl (name TBD) that mutates cluster inside the current Context? And maybe even kubeusr (or something) that does the same for user?


As far as I understand, the current assumption behind kubectx is that each Context is completely isolated (e.g. minikube vs GKE), so switching between Clusters while keeping User and even Namespace is meaningless.

On the other hand, I'd like to be able to switch between multiple production Clusters while keeping the same User and Namespace. With an extra benefit of not having to create N contexts for managing N clusters.

Do you think such a PR would be a good idea?

ahmetb commented 6 years ago

I think in general I'm open to it, we can put it behind an installation flag as experimental.

However, I am inclined to think there are not many people doing this. kubectl does not even provide any commands to add/switch/delete user configs. (https://github.com/kubernetes/kubectl/issues/396).

If it's an exotic/rare use case, we'd like to keep it out to prevent feature creep. So, first I'd like to understand if there are more people like you.

ahmetb commented 6 years ago

This is likely a wontfix for now.

gmiroshnykov commented 6 years ago

I should mention that I actually have it implemented here: https://github.com/laggyluke/kubectx/tree/kubeclr

I didn't have enough time to add completion support and update docs, but if it'll turn out I'm not the only one who was looking for this feature - just let me know and I'll prepare a proper PR :)