How to install kubectl on Linux | Install kubectl on Amazon Linux

install kubectl on Linux | Install kubectl on Amazon Linux


What is kubectl ?

Kubernetes provides a command line tool for communicating with a Kubernetes cluster's control plane and cluster API server, using the Kubernetes API.

For configuration, kubectl looks for a file named config in the $HOME/.kube directory. You can specify other kubeconfig files by setting the KUBECONFIG environment variable or by setting the --kubeconfig flag.

Table of Content :

1). Install kubectl on Amazon Linux

Download Amazon EKS-vended kubectl binary from Amazon S3

sudo curl -o kubectl https://amazon-eks.s3.us-west-2.amazonaws.com/1.16.8/2020-04-16/bin/linux/amd64/kubectl

Apply execute permissions to the binary

sudo chmod +x ./kubectl

Copy the binary into a folder and add it to the 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 it is configured when you open a shell.

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

Verify if kubectl got installed

kubectl version --short --client

2). Install kubectl on Debian Linux

Update the apt package index and install packages needed to use the Kubernetes apt repository:

sudo apt-get update sudo apt-get install -y apt-transport-https ca-certificates curl

Download the Google Cloud public signing key:

sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg

Add the Kubernetes apt repository:

echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list

Update the apt package index with the new repository and install kubectl:

sudo apt-get update sudo apt-get install -y kubectl

Questions Related to Install kubectl on Amazon Linux

How do I install Kubernetes on AWS? - You need to use the AWS EKS service.

How To Install Nginx on Ubuntu
How To Install and Configure Elasticsearch on Ubuntu 20.04

In this article, we have seen How to install kubectl on Linux | Install kubectl on Amazon Linux