• NOTICE: If you are reading this, you are hitting our new server. We expect there to be some bugs - please let us know if you come across anything, THANKS!

Install kubectl and minikube on Linux

Rob

Administrator
Staff member
Kubernetes is a great way to deploy your applications - and it's VERY popular out there with teams working in technology. Before you get going though, you'll need to install the kubectl cli tool and you may as well install minikube so you can test things out. Minikube is a non-production sandbox environment that you can use to test out kubernetes.

This article will show you how to install the latest versions of both - and we'll go into using them in another future article. There are tons of useful youtube videos out there as well that can get you going once you have these installed.

Installing kubectl on Linux

Now, this won't matter if you're running fedora, ubuntu, centos or any other Linux distribution as long as you have curl installed.

To install the latest version of kubectl on Linux, simply open up a terminal and download the latest using curl. You can do this as a regular user.
Code:
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl

Once downloaded, you need to make it executable.
Code:
chmod +x ./kubectl

Next, just move it somewhere in your $PATH so you can just type its name w/o needing to type out the full path. You'll need sudo for this if you move it into /usr/local/bin/.
Code:
sudo mv ./kubectl /usr/local/bin/

You could move it into another $PATH location as well - maybe one from your home directory. To get a full list of your $PATH locations, simply type echo $PATH on your terminal.

After moving it, you can now test to see if it works.
Code:
kubectl

You should see the help file come up since you didn't give it any arguments.

Here's a quick asciinema showing the process:


Virtualbox

To install minikube, you'll need to ensure you have Virtualbox installed. If you don't have it, you can download for your distribution here:

Installing minikube on Linux

This is VERY similar to installing kubectl. Again, it doesn't matter which flavor of Linux you're using.

Now that you have Virtualbox installed, you can use curl to download the latest version of minikube.
Code:
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
Next, make it executable with chmod
Code:
chmod +x ./minikube
Finally, move it somewhere in your $PATH
Code:
sudo mv ./minikube /usr/local/bin/
Now, type minikube to get its help page.

To start minikube, type minikube start.

Once it has started (it may take a while, but it'll update you along the way) type kubectl get all and you'll likely see something similar to this output:
Code:
[[email protected] ~]$ kubectl get all
NAME                 TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
service/kubernetes   ClusterIP   10.96.0.1    <none>        443/TCP   88s
To stop minikube, simply type minikube stop.

I hope this has been helpful. We'll follow up with some kubernetes (k8s) basics to get you going!
 
Last edited:

Members online


Top