How to upgrade kubectl client version

12/10/2018

I want to upgrade the kubectl client version to 1.11.3.

I executed brew install kubernetes-cli but the version doesnt seem to be updating.

Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.7", GitCommit:"0c38c362511b20a098d7cd855f1314dad92c2780", GitTreeState:"clean", BuildDate:"2018-08-20T10:09:03Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.4", GitCommit:"bf9a868e8ea3d3a8fa53cbb22f566771b3f8068b", GitTreeState:"clean", BuildDate:"2018-10-25T19:06:30Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}

I'm trying to get the logs for a cell by running this command.

kubectl logs -l groupname/cell=my-cell --all-containers=true

This works in my VM which has client version 1.11.3. But in my mac it gives me an error saying --all-containers=true flag is not available for kubectl logs command.

-- Madhuka Wickramapala
homebrew
kubectl
kubernetes
macos

8 Answers

4/3/2020

My docker desktop used an old version of kubectl. After installing gcloud components install kubectl the installer yields a warning of the location of the outdated kubectl version:

WARNING: There are older versions of Google Cloud Platform tools on your system PATH. Please remove the following to avoid accidentally invoking these old tools:

/Applications/Docker.app/Contents/Resources/bin/kubectl

I have removed the folder and kubectl run fine.

-- boraas
Source: StackOverflow

4/24/2020

Similar to what boraas said. The version you are seeing is from another kubectl.exe installation. I had docker for windows installed which already has kubectl.exe (located in Docker\resources\bin) and was of older version. This gets used unless you provide explicitly the path to the new location of your kubectl.exe [you need to set it in PATH].

-- Shuma Dev
Source: StackOverflow

4/21/2020

I landed here after I faced problem while downloading kubectl from aws. kubectl installation was failing because I had kubectl in my machine.

After I removed, was able to install kubectl 1.15.11 from aws.

lrwxr-xr-x  1 root      admin      55 Jan 11 17:49 kubectl.docker -> /Applications/Docker.app/Contents/Resources/bin/kubectl
lrwxr-xr-x  1 root      admin      55 Jan 11 17:49 kubectl -> /Applications/Docker.app/Contents/Resources/bin/kubectl ```
-- user1769790
Source: StackOverflow

12/10/2018

Install specific version of kubectl

curl -LO https://storage.googleapis.com/kubernetes-release/release/<specific-kubectl-version>/bin/darwin/amd64/kubectl

For your case if you want to install version v1.11.3 then replace specific-kubectl-version with v1.11.3

Then make this binary executable

chmod +x ./kubectl

Then move this binary to your PATH

sudo mv ./kubectl $(which kubectl)
-- Abu Hanifa
Source: StackOverflow

10/27/2019

If you have installed it with brew, you can just run brew upgrade kubernetes-cli.

-- Milkncookiez
Source: StackOverflow

12/10/2018

I had installed kubectl using google-cloud-sdk. So in my path kubectl was pointing to this location. That is why the version did not update. Kubectl got updated after I removed that from the path.

-- Madhuka Wickramapala
Source: StackOverflow

11/3/2019

To install OR upgrade the version of kubectl Server and Client on MacOS X is very easy if you follow the detailed install guide on the Kubernetes install page https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-on-macos

Hope it helps :)

-- Valentin Florea
Source: StackOverflow

2/13/2020

Via Chocolatey:

choco upgrade kubernetes-cli
-- Rodion Sychev
Source: StackOverflow