Use specific kubectl version


07/20/2023, 10:23 AM
Hi, For a helm sync operation, I see garden trying to run a kubectl command like below
Copy code
/Users/ankitmishra/.garden/tools/kubectl/f8a39834529cd1ed/kubectl --context=<context> --namespace=garden-test apply --output=json -f -
I checked the version of kubectl and it is a couple of versions behind the version we run in our cluster
Copy code
/Users/ankitmishra/.garden/tools/kubectl/f8a39834529cd1ed/kubectl version
Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.3", GitCommit:"816c97ab8cff8a1c72eccca1026f7820e93e0d25", GitTreeState:"clean", BuildDate:"2022-01-25T21:25:17Z", GoVersion:"go1.17.6", Compiler:"gc", Platform:"darwin/arm64"}
Server Version: version.Info{Major:"1", Minor:"25+", GitVersion:"v1.25.11-eks-a5565ad", GitCommit:"df109513ba589adaee235b4e658476275d1fde31", GitTreeState:"clean", BuildDate:"2023-06-16T17:35:00Z", GoVersion:"go1.19.10", Compiler:"gc", Platform:"linux/amd64"}
WARNING: version difference between client (1.23) and server (1.25) exceeds the supported minor version skew of +/-1
This is causing issues with the sync as shown below.
Copy code
error: error validating "STDIN": error validating data: ValidationError(Deployment.spec): unknown field "topologySpreadConstraints" in io.k8s.api.apps.v1.DeploymentSpec; if you choose to ignore these errors, turn validation off with --validate=false
My question is, can I specify the kubectl version or the kubectl path so that I can work around the issue? An easy fix would be to copy the binary in the garden kubectl destination, but is that the recommended way to proceed?


07/20/2023, 10:39 AM
Hi @flaky-plumber-11624 and welcome to the community! 💐 The canonical way is to declare the path of your kubectl binary in your provider block: