Installing Kubectl

How to install kubectl on linux

Kubernetes uses a command-line utility called kubectl, for communicating with the cluster API server. The kubectl binary is available in many operating system package managers, and this option is often much easier than a manual download and install process. You can follow the instructions for your specific operating system or package manager in the Kubernetes documents to install.

Download the Amazon EKS vended kubectl binary for your cluster’s Kubernetes version from Amazon S3. To download the Arm version, change amd64 to arm64 before running the command.

for kubernetes 1.20 version:-

curl -o kubectl https://amazon-eks.s3.us-west-2.amazonaws.com/1.20.4/2021-04-12/bin/linux/amd64/kubectl

for kubernetes 1.19 version:-

curl -o kubectl https://amazon-eks.s3.us-west-2.amazonaws.com/1.19.6/2021-01-05/bin/linux/amd64/kubectl

Apply executable permissions to the binary.

chmod +x ./kubectl

Copy the binary to a folder in your PATH. If you have already installed a version of kubectl, then we recommend creating a $HOME/bin/kubectl and ensuring that $HOME/bin comes first in your $PATH.

mkdir -p $HOME/bin && cp ./kubectl $HOME/bin/kubectl && export PATH=$PATH:$HOME/bin

Add the $HOME/bin path to your shell initialization file so that it is configured when you open a shell.

echo 'export PATH=$PATH:$HOME/bin' >> ~/.bashrc

After you install kubectl , you can verify its version with the following command:

kubectl version --short --client

So today we learned “How we can install kubectl command on linux”..

Check our latest blog – How to setup/create EKS cluster?

 

1 thought on “Installing Kubectl”

Leave a Reply

Your email address will not be published. Required fields are marked *