In the previous post, we have prepared an environment for work. Now we will be installing and configuring Docker and Kubernetes on our Ubuntu Server.
Installing Docker and Kubernetes on Ubuntu Server
Let’s start with turning on the VM with Ubuntu Server and connecting via SSH to the machine (I described this in the previous post). First, use the following commands to install Docker:
Then use the following commands to install Kubernetes:
In the end, turn off the swap on Ubuntu Server because it is required in the changelog:
That’s all. Check if Docker and Kubernetes were installed using the commands:
You should see a similar result:
Creating Single Node Kubernetes Cluster with Kubeadm
We will use kubeadm which helps bootstrap Kubernetes cluster. Detailed documentation is available on the kubernetes website. I will present some of the most important steps that will create a working cluster in a few minutes.
At the beginning, install kubectl using the following command:
Now we can create a single node cluster:
Remember to change –apiserver-advertise-address=192.168.0.129 with your VM inet address. If you do not know how to check inet IP - read the instructions from the previous post. After a few minutes of installation, you should see the message:
In order for Kubernetes to work for a non-root user, you must run the following commands:
Configuring Kubernetes Cluster Networking
After kubernetes installation, we need to configure networking. This is detailed in the documentation . Execute two commands to set the networking:
Master Node as a Worker
Finally, we have to use the kubectl taint command, so that our master node can create pods and be used as a worker node:
That’s all! We have created a working single node cluster. In the next post, I will show you how to create an admin dashboard in Kubernetes to be able to easily manage a cluster from the browser.