Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: allow configuration of kubectl versions. #6

Open
ImIOImI opened this issue May 9, 2023 · 1 comment
Open

Feature request: allow configuration of kubectl versions. #6

ImIOImI opened this issue May 9, 2023 · 1 comment

Comments

@ImIOImI
Copy link

ImIOImI commented May 9, 2023

The Problem:
The Env0 agent is currently on version 1.23. K8s version 1.24 is scheduled for end of life in July of 2023. According to Env0's own documentation

Supported versions

The kubectl version is 1.23, and the kustomize version is 4.5.4.
It is recommended for the remote cluster not to be more than 1 minor version ahead or behind the client's.

This means that anyone using Azure will be outside the recommended compatibility range of the Env0 Kubectl client. Furthermore, it limits any customer upgrades to 1.25 because of the api changes with HPAs in version 1.26.

The Solution
IMO, it's unrealistic to imagine that you can satisfy the whims of every one of your clients with a single pre-installed Kubectl version. We run into the same problem with Terraform, but instead of installing any particular version of Terraform, you use tfenv to manage the Terraform binaries. There's a similar project for kubectl called kbenv that employs the same usage pattern.

I would really like to see the ability to run whatever kubectl version I need, just like I can do with Terraform.

@ImIOImI
Copy link
Author

ImIOImI commented Jul 5, 2023

if anyone else finds this especially in the light of the new upgrade, I added this script to my env0.yml in the before hooks for planning and applying:

### Adding kbenv
# https://github.com/little-angry-clouds/kubernetes-binaries-managers/tree/master/cmd/kbenv
mv /opt/kubectl /opt/kubectl.bak

wget https://github.com/little-angry-clouds/kubernetes-binaries-managers/releases/download/v1.0.0/kubernetes-binaries-managers_1.0.0_linux_amd64.tar.gz
tar -xzf kubernetes-binaries-managers_1.0.0_linux_amd64.tar.gz
mv kubectl-linux-amd64/kbenv /opt/kbenv
mv kubectl-linux-amd64/kubectl-wrapper /opt/kubectl

echo "installing kubectl version: ${KubectlVersion}"
kbenv install "${KubectlVersion}"
kbenv use "${KubectlVersion}"

echo "path to kubectl: $(which kubectl)"
echo "kubectl version: $(kubectl version --client  --short)"

kubectl config view

Then I pass in an environmental variable KubectlVersion with the kubectl version I need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant