Install kubectl on Ubuntu Instance | How to install kubectl in Ubuntu
Table of contents
Kubernetes uses a command line utility called kubectl
for communicating with the cluster API server. It is a tool for controlling Kubernetes clusters. kubectl
looks for a file named config in the $HOME directory.
How to install Kubectl in Ubuntu instance
Update the
apt
package index and install packages needed to use the Kubernetesapt
repository:sudo apt-get update sudo apt-get install -y ca-certificates curl
If you use Debian 9 (stretch) or earlier you would also need to install
apt-transport-https
:sudo apt-get install -y apt-transport-https
Download the Google Cloud public signing key:
curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-archive-keyring.gpg
Add the Kubernetes
apt
repository:echo "deb [signed-by=/etc/apt/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
Update
apt
package index with the new repository and install kubectl:sudo apt-get update sudo apt-get install -y kubectl
Verify if kubectl got installed
kubectl version --short --client