This blog post will show how to install a specific version Kubectl command-line utility on a Ubuntu server.
Kubectl is a command-line tool that provides an interface to control the cluster and its components. It can be used to execute commands in one or more containers, submit new workloads for scheduling on clusters, get logs from containers running in a cluster, and so on.
To install a specific version of kubectl, we first need to go to the releases (URL below) page and find the version we would like to install.
In my case, I will install version 1.22.5. In the below curl command, I have set the version number. Once you set the version number, run the command.
curl -LO https://dl.k8s.io/release/v1.22.5/bin/linux/amd64/kubectl
After downloading the specific version to my server, I will run the command below to install it.
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
The final step will be checking that the specific version is installed.
kubectl version --output yaml