kubectl version switcher
$ go get -v -u github.com/kenichi-shibata/kubectl-switch/
$ kubectl-switch version
v0.0.3
$ kubectl-switch download -k v1.15.11
$ export PATH=~/.kube/kubectl:$PATH # you might want to add this in your bashrc or zshrc
$ kubectl version --client # to verify
Because Kubectl Version Skew https://kubernetes.io/docs/setup/version-skew-policy/
If you work with two clusters with at least 2 minor versions apart then there will be functionalities that will be missing. You need to switch your version.
Kubectl-Switch to the rescue
git clone [email protected]:kenichi-shibata/kubectl-switch
go build .
./kubectl-switch
kubectl-switch download # get the latest stable version
kubectl-switch download -k v.1.11.9 # switch to verison v1.11.9
# list available versions
ls ~/.kube/kubectl/
This creates a config file at ~/.kube/kubectl/config
if its not created already. Otherwise it will read these values
{
"url_prefix": "https://storage.googleapis.com/kubernetes-release/release",
"version": "v1.14.3"
}
The binares will created in ~/.kube/kubectl/
and the main symlink will be in ~/.kube/kubectl/kubectl
which will be symlinked to the active version.
- asdf with kubectl-plugin
curl -s https://api.github.com/repos/kubernetes/kubernetes/releases?per_page=100 | jq .[].Name > supported_versions
List of all supported versions
https://raw.githubusercontent.com/kenichi-shibata/kubectl-switch/master/supported_versions