Here we are going to learn about how to install kubectl on Linux. We have to use a version of kubectl that is the same or later version as our server. Validation error will occur while we are using an older kubectl with a newer server.
1. Download the latest release with the command:
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
If you want to download the specific version use the command with version number as follows:
curl -LO https://dl.k8s.io/release/v1.24.0/bin/linux/amd64/kubectl
2. Build the kubectl binary executable.
chmod +x ./kubectl
3. Change the binary in to our PATH.
sudo mv ./kubectl /usr/local/bin/kubectl
4. Download and Install as part of the Google Cloud SDK
As a part of kubectl installation the Google Cloud SDK has to be intstall.
Run the following command to install kubectl:
gcloud components install kubectl
5. Run kubectl version to verify that the verison we have installed is sufficiently up-to-date.
kubectl version --client
Comments (0)