If you’re looking at setting up a Kubernetes cluster (to empower your business with scalable, high-availability containers), you’re going to have to first install the necessary components:

  • kubectl – the command line interface that enables you to run commands against your Kubernetes cluster.
  • Docker – the package that enables the creation of containers
  • minikube – enables you to run Kubernetes locally
  • kubeadm – helps you to install and set up a Kubernetes cluster

Without these particular parts of the puzzle, you will not be able get your Kubernetes cluster up and running. Although the installation of the above packages isn’t terribly complex, it’s also not terribly intuitive–nor can you find kubectl, minikube, or kubeadm in the standard repositories.

I want to walk you through the process of getting these four pieces of software installed on the Ubuntu Linux Server platform. Naturally, you’ll need to install them on all of the machines you plan on adding to your cluster; but for the purpose of this exercise, I will demonstrate install them on a single machine. I’ll be using Ubuntu Server 16.04.

Installing Docker

Docker is the simple part of this installation. From your terminal window, issue the following command to install this requirement:

sudo apt-get install docker.io

Once that installs, you’re ready to continue on.

Installation of kubectl

The installation of kubectl isn’t exactly intuitive. There are a few methods for installing kubectl. However, I want to make sure to install the latest version. To do this, open up your terminal window and then issue the following commands:

cd ~/Downloads
sudo -s
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl

This will download the kubectl binary into your user Downloads directory. Clearly, you need to be able to not only run the binary file, but run it globally. In order to run the file, we must give it executable permissions with the command:

chmod u+x kubectl

Now we’re going to move the binary file into a directory that is included in the user $PATH. To make this easier, I’m going to assume (for the rest of the commands outlined) you will remain with root access (which was achieved with the command sudo –s). Issue the command:

mv ~/Downloads/kubectl /usr/local/bin/kubectl

The binary file can now be run from any directory on your system.

Installing minikube

We’ll install minikube in the same manner as we installed kubectl (but with a single command). From your terminal window, issue the following command:

curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.20.0/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/

That one command will give the minikube binary executable rights and move it to /usr/local/bin, so there’s nothing more to do.

Installing kubeadm

This installation gets a bit more complicated, but not by much. The kubeadm software will be installed from a third-party repository. From your terminal window you must first install apt-transport-https with the following command:

apt-get update && apt-get install -y apt-transport-https

Now add the necessary apt-key with the command:

curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -

Add the repository by issuing the command nano /etc/apt/sources.list.d/kubernetes.list and adding the following contents:

deb http://apt.kubernetes.io/ kubernetes-xenial main

Save and close that file

Now we can update apt and install the necessary software with the commands:

apt-get update
​apt-get install -y kubelet kubeadm

You’re all set

At this point, you now have everything ready to create your Kubernetes cluster. When next we visit this topic, we’ll be creating a cluster, using the kubeadm command. Until then, have a read through the Kubernetes documentation to see what more you can do with these powerful tools.