ahmetb / kubectx

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

Feature Request: Use kubectx to use right version of kubectl binary for a given K8s cluster #388

Closed stephan242 closed 1 year ago

stephan242 commented 1 year ago

I have several K8s clusters I choose from, some are version 1.23, some 1.27. Since kubectl is officially supported one version up one version down, to be on the safe side I always have to remember to manually change the kubectl binary I'm using. Would be nice if it was possible to make that part of the selection process of kubectx. I can think of several different ways to do that:

Have something like a hook script or command associated with a given cluster, which could be configured to somehow change the kubectl binary the system uses, e.g. via asdf.

Even better: Have kubectx work it out by itself with kubectl version and update (maybe with the help of asdf) the kubectl version in use.

ahmetb commented 1 year ago

This is not in scope for kubectx.

You can write a version manager for kubectl that wraps actual kubectl that does that for you.