In this tutorial we will show you how to install Kubernetes on Ubuntu 18.04 LTS. For those of you who didn’t know, Kubernetes is a free and open-source container management system that provides a platform for deployment automation, scaling, and operations of application containers across clusters of host computers. With Kubernetes, you can freely make use of the hybrid,on-premise, and public cloud infrastructure in order to run deployment tasks of your organization.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo’ to the commands to get root privileges. I will show you through the step by step installation Kubernetes on a Ubuntu 18.04 (Bionic Beaver) server.
Install Kubernetes on Ubuntu 18.04 LTS Bionic Beaver
Step 1. First, make sure that all your system packages are up-to-date by running these following apt commands in the terminal.
Now we have to install Docker because Docker images will be used for managing the containers in the cluster. Run the following commands:
Once the Docker is installed ensure that it is enabled to start after reboot:
First, add the Kubernetes signing key on both the nodes:
curl-shttps://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add
Next, add Xenial Kubernetes Repository on both the nodes:
sudoapt-add-repository"deb http://apt.kubernetes.io/ kubernetes-xenial main"
The final step in the installation process is to install Kubeadm on both the nodes through the following command:
Check the version number of Kubeadm and also verify the installation through the following command:
First, disable swap memory (if running) on both the nodes:
Next, give hostnames to each node:
- Initialize Kubernetes on the master node:
You can check the status of the master node by running the following command:
- Deploy a Pod Network through the master node:
A pod network is a medium of communication between the nodes of a network:
Use the following command in order to view the status of the network:
Now when you see the status of the nodes, you will see that the master-node is ready:
Next, add the slave node to the network in order to form a cluster:
Now when you run the following command on the master node, it will confirm that two nodes, the master node, and the server nodes are running on your system:
Congratulation’s! You have successfully installed Kubernetes. Thanks for using this tutorial for installing Kubernetes on Ubuntu 18.04 systems. For additional help or useful information, we recommend you to check the official Kubernetes website.