kubectl
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 documentation to install.html
This topic helps you to download and install the Amazon EKS-vended kubectl binaries for MacOS, Linux, and Windows operating systems.linux
This section helps you to install kubectl
for MacOS clients.windows
To install kubectl
on MacOSbash
Download the Amazon EKS-vended kubectl binary from Amazon S3:curl
curl -o kubectl https://amazon-eks.s3-us-west-2.amazonaws.com/1.11.5/2018-12-06/
curl -o kubectl https://amazon-eks.s3-us-west-2.amazonaws.com/1.11.5/2018-12-06/bin/darwin/amd64/kubectl
bin/darwin/amd64/kubectl
bin/darwin/amd64/kubectl
(Optional) Verify the downloaded binary with the SHA-256 sum for your binary.ide
Download the SHA-256 sum for MacOS:ui
curl -o kubectl.sha256 https://amazon-eks.s3-us-west-2.amazonaws.com/1.11.5/2018-12-06/
curl -o kubectl.sha256 https://amazon-eks.s3-us-west-2.amazonaws.com/1.11.5/2018-12-06/bin/darwin/amd64/kubectl.sha256
bin/darwin/amd64/kubectl.sha256
bin/darwin/amd64/kubectl.sha256
Check the SHA-256 sum for your downloaded binary.this
openssl sha -sha256 kubectl
openssl sha -sha256 kubectl
Compare the generated SHA-256 sum in the command output against your downloaded SHA-256 file. The two should match.url
Apply execute permissions to the binary.
chmod +x ./kubectl
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 $HOME/bin && cp ./kubectl $HOME/bin/kubectl && export PATH=$HOME/bin:$PATH
mkdir $HOME/bin && cp ./kubectl $HOME/bin/kubectl && export PATH=$HOME/bin:$PATH
(Optional) Add the $HOME/bin
path to your shell initialization file so that it is configured when you open a shell.
echo 'export PATH=$HOME/bin:$PATH' >> ~/.bash_profile
echo 'export PATH=$HOME/bin:$PATH' >> ~/.bash_profile
After you install kubectl, you can verify its version with the following command:
kubectl version --short --client
kubectl version --short --client
This section helps you to install kubectl
for Linux clients.
To install kubectl
on Linux
Download the Amazon EKS-vended kubectl binary from Amazon S3:
curl -o kubectl https://amazon-eks.s3-us-west-2.amazonaws.com/1.11.5/2018-12-06/
curl -o kubectl https://amazon-eks.s3-us-west-2.amazonaws.com/1.11.5/2018-12-06/bin/linux/amd64/kubectl
bin/linux/amd64/kubectl
bin/linux/amd64/kubectl
(Optional) Verify the downloaded binary with the SHA-256 sum for your binary.
Download the SHA-256 sum for Linux:
curl -o kubectl.sha256 https://amazon-eks.s3-us-west-2.amazonaws.com/1.11.5/2018-12-06/
curl -o kubectl.sha256 https://amazon-eks.s3-us-west-2.amazonaws.com/1.11.5/2018-12-06/bin/linux/amd64/kubectl.sha256
bin/linux/amd64/kubectl.sha256
bin/linux/amd64/kubectl.sha256
Check the SHA-256 sum for your downloaded binary.
openssl sha -sha256 kubectl
openssl sha -sha256 kubectl
Compare the generated SHA-256 sum in the command output against your downloaded SHA-256 file. The two should match.
Apply execute permissions to the binary.
chmod +x ./kubectl
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 $HOME/bin && cp ./kubectl $HOME/bin/kubectl && export PATH=$HOME/bin:$PATH
mkdir $HOME/bin && cp ./kubectl $HOME/bin/kubectl && export PATH=$HOME/bin:$PATH
(Optional) Add the $HOME/bin
path to your shell initialization file so that it is configured when you open a shell.
Note
This step assumes you are using the Bash shell; if you are using another shell, change the command to use your specific shell initialization file.
echo 'export PATH=$HOME/bin:$PATH' >> ~/.bashrc
echo 'export PATH=$HOME/bin:$PATH' >> ~/.bashrc
After you install kubectl, you can verify its version with the following command:
kubectl version --short --client
kubectl version --short --client
This section helps you to install kubectl
for Windows clients with PowerShell.
To install kubectl
on Windows
Open a PowerShell terminal.
Download the Amazon EKS-vended kubectl binary from Amazon S3:
curl -o kubectl.exe https://amazon-eks.s3-us-west-2.amazonaws.com/1.11.5/2018-12-06/
curl -o kubectl.exe https://amazon-eks.s3-us-west-2.amazonaws.com/1.11.5/2018-12-06/bin/windows/amd64/kubectl.exe
bin/windows/amd64/kubectl.exe
bin/windows/amd64/kubectl.exe
(Optional) Verify the downloaded binary with the SHA-256 sum for your binary.
Download the SHA-256 sum for Windows:
curl -o kubectl.exe.sha256 https://amazon-eks.s3-us-west-2.amazonaws.com/1.11.5/2018-12-06/
curl -o kubectl.exe.sha256 https://amazon-eks.s3-us-west-2.amazonaws.com/1.11.5/2018-12-06/bin/windows/amd64/kubectl.exe.sha256
bin/windows/amd64/kubectl.exe.sha256
bin/windows/amd64/kubectl.exe.sha256
Check the SHA-256 sum for your downloaded binary.
Get-FileHash kubectl.exe
Get-FileHash kubectl.exe
Compare the generated SHA-256 sum in the command output against your downloaded SHA-256 file. The two should match, although the PowerShell output will be uppercase.
Copy the binary to a folder in your PATH
. If you have an existing directory in your PATH that you use for command-line utilities, copy the binary to that directory. Otherwise, complete the following steps.
Create a new directory for your command-line binaries, such as C:\bin
.
Copy the kubectl.exe
binary to your new directory.
Edit your user or system PATH environment variable to add the new directory to your PATH.
Close your PowerShell terminal and open a new one to pick up the new PATH variable.
After you install kubectl, you can verify its version with the following command:
kubectl version --short --client
kubectl version --short --client
refer: https://docs.aws.amazon.com/eks/latest/userguide/install-kubectl.html