×


Install Kubectl on Linux Mint 20 - Best Method ?

Kubectl is in fact the command-line tool for Kubernetes. It allows you to operate your Kubernetes clusters via a command-line interface by passing relevant commands through it. It is capable of deploying applications, managing the clusters, viewing their logs, etc.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related Kubernetes queries.

In this context, we shall look into how to Install Kubectl on a Linux Mint 20 machine.


How to Install Kubectl on Linux Mint 20 ?

To install the Kubernetes command-line tool on your Linux system, you need to perform the following steps.


1. Install all the Required Packages and Dependencies

To begin, you should install some required packages and dependencies before installing Kubectl on your system with the help of the command shown below:

$ sudo apt-get install –y apt-transport-https ca-certificates curl


2. Download the Relevant Public Key

Now, you need to download the Google Cloud public signing key on your Linux system with the following command:

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


3. Add the Kubernetes Repository to your System

After that, you need to add the Kubernetes repository to your system by executing the command shown below:

$ 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

This command will successfully add Kubernetes repository to your system.


4. Fix all the Broken Links and Dependencies

Now, you need to fix all the broken links and dependencies by updating your system with the command shown below:

$ sudo apt-get update


5. Install Kubectl on your System

Finally, you can install Kubectl on your system by running the following command:

$ sudo apt-get install –y kubectl


6. Check the Version of Kubectl on your System

Once Kubectl has been installed successfully on your Linux Mint 20 system, you can look for its installed version by executing the command shown below:

$ kubectl version

This command will display the version of Kubectl installed on the system.


How to Uninstall Kubectl from Linux Mint 20 ?

If you wish to remove Kubectl from your system, then you will have to perform the two steps shown below:

1. Remove Kubectl from your System

First, you need to uninstall Kubectl from your system with the help of the following command:

$ sudo apt-get purge --autoremove kubectl

2. Remove all the Extra Installed Packages and Dependencies from your System

After uninstalling Kubectl from your system, you can additionally remove all the extra packages and dependencies that you installed earlier before installing Kubectl on your system. This can be done by running the command shown below:

$ sudo apt-get purge --autoremove apt-transport-https ca-certificates curl


[Need help in fixing kubernetes system configuration issues? We can help you. ]


Conclusion

This article covers how you can install Kubectl on your Linux system and use it to operate your Kubernetes clusters if you are fond of using the command-line interfaces. Infact, Kubectl tool is very efficient in terms of cluster management and application deployment. 

Kubectl is a command-line tool for Kubernetes. It allows us to execute Kubernetes operations via the API. We can use Kubectl to deploy apps, check logs as well as manage all the other resources of the cluster.

Kubernetes uses an HTTP-based REST API which is the actual Kubernetes user interface employed to manage it. This means that every Kubernetes operation is represented as an API endpoint and can be carried out based on an HTTP-request sent to the endpoint.