Would you like to learn how to do a Kubernetes cluster installation on Ubuntu Linux? In this tutorial, we are going to show you how to install a Kubernetes cluster on a computer running Ubuntu Linux.

• Ubuntu 20
• Ubuntu 19
• Ubuntu 18
• Kubernetes 1.18

In our example, The Kubernetes master node IP address is 192.168.100.9.

In our example, The Kubernetes secondary node IP address is 192.168.100.10.

Kubernetes - Tutorials

On this page, we offer quick access to a list of tutorials related to Kubernetes.

Tutorial Kubernetes Cluster - Master Node Installation

• IP - 192.168.100.9
• Hostname - KUBERNETES-01.LOCAL

Install the list of required packages.

Copy to Clipboard

Install the Docker service.

Copy to Clipboard

Enable the Docker service during boot.

Copy to Clipboard

Edit the Docker service configuration file.

Copy to Clipboard

Add the following configuration at the end of the item named: EXECSTART

Copy to Clipboard

Here is the file before our configuration.

Copy to Clipboard

Here is the file after our configuration.

Copy to Clipboard

Create a System configuration file.

Copy to Clipboard

Here is the file content.

Copy to Clipboard

Enable the System configuration file.

Copy to Clipboard

Edit the configuration file named: MODULES.CONF

Copy to Clipboard

Add the following configuration at the end of this file.

Copy to Clipboard

Edit the FSTAB configuration file and disable the use of Swap memory.

Copy to Clipboard

Here is the file before our configuration.

Copy to Clipboard

Here is the file after our configuration.

Copy to Clipboard

Set a unique hostname.

Copy to Clipboard

Edit the configuration file named HOSTS.

Copy to Clipboard

Add an entry to the secondary Kubernetes node.

Copy to Clipboard

Create a file to configure the required environment variables.

Copy to Clipboard

Here is the file content.

Copy to Clipboard

Reboot the computer.

Copy to Clipboard

Download and install the Kubernetes repository key.

Copy to Clipboard

Add the official Kubernetes repository.

Copy to Clipboard

Install the Kubernetes packages.

Copy to Clipboard

Download the required Kubernetes images.

Copy to Clipboard

Here is the command output.

Copy to Clipboard

Initialize the Kubernetes cluster.

Copy to Clipboard

Here is the command output.

Copy to Clipboard

Take note of the command to add nodes to the Kubernetes cluster.

Copy to Clipboard

Set the correct file permission on the Kubernetes configuration file.

Copy to Clipboard

Install the required network configuration for PODs.

Copy to Clipboard

Install the controller of Ingress.

Copy to Clipboard

By default, the Kubernetes master node is not allowed to run PODS.

Optionally, enable the Kubernetes master node to run PODS.

Copy to Clipboard

Congratulations! You have finished the Kubernetes installation on Ubuntu Linux.

Tutorial Kubernetes Cluster - Secondary Node Installation

• IP - 192.168.100.10
• Hostname - KUBERNETES-02.LOCAL

Install the list of required packages.

Copy to Clipboard

Install the Docker service.

Copy to Clipboard

Enable the Docker service during boot.

Copy to Clipboard

Edit the Docker service configuration file.

Copy to Clipboard

Add the following configuration at the end of the item named: EXECSTART

Copy to Clipboard

Here is the file before our configuration.

Copy to Clipboard

Here is the file after our configuration.

Copy to Clipboard

Create a System configuration file.

Copy to Clipboard

Here is the file content.

Copy to Clipboard

Enable the System configuration file.

Copy to Clipboard

Edit the configuration file named: MODULES.CONF

Copy to Clipboard

Add the following configuration at the end of this file.

Copy to Clipboard

Edit the FSTAB configuration file and disable the use of Swap memory.

Copy to Clipboard

Here is the file before our configuration.

Copy to Clipboard

Here is the file after our configuration.

Copy to Clipboard

Set a unique hostname.

Copy to Clipboard

Edit the configuration file named HOSTS.

Copy to Clipboard

Add an entry to the Kubernetes master node.

Copy to Clipboard

Reboot the computer.

Copy to Clipboard

Download and install the Kubernetes repository key.

Copy to Clipboard

Add the official Kubernetes repository.

Copy to Clipboard

Install the Kubernetes packages.

Copy to Clipboard

Join the Kubernetes cluster.

Copy to Clipboard

In our example, this computer joined the Kubernetes cluster installed on the master node 192.168.100.9.

Keep in mind, that you need to use the custom command created by the master node to join your cluster.

Here is the command output.

Copy to Clipboard

Congratulations! You have joined the Kubernetes cluster.

Tutorial Kubernetes - Testing the Cluster

On the master node, list the members of the Kubernetes cluster.

Copy to Clipboard

Here is the command output.

Copy to Clipboard

Create a deployment using the Nginx image.

Copy to Clipboard

In our example, we created a deployment named TEST.

Wait for the system to download the Nginx image and start the POD.

List the PODs installed on the cluster.

Copy to Clipboard

Here is the command output.

Copy to Clipboard

In our example, the POD created is running on the following node: KUBERNETES-02.LOCAL

Scale our deployment to 3 replicas.

Copy to Clipboard

Verify the Kubernetes deployment.

Copy to Clipboard

Here is the command output.

Copy to Clipboard

List the PODs installed on the cluster.

Copy to Clipboard

Here is the command output.

Copy to Clipboard

In our example, we have 3 PODs running on the following node: KUBERNETES-02.LOCAL

Create a YAML file with the new service configuration.

Copy to Clipboard

Here is the file content.

Copy to Clipboard

Do not change the YAML file indentation used above.

Install the new Kubernetes service.

Copy to Clipboard

Verify the list of Kubernetes services.

Copy to Clipboard

Here is the command output.

Copy to Clipboard

In our example, we created a new service named TEST-WEB.

In our example, we exposed port 80 from our deployment as the port 80 of host 192.168.100.9.

Use the CURL command to test the communication to our Nginx deployment.

Copy to Clipboard

Open your browser and enter the IP address of your Kubernetes server.

In our example, the following URL was entered in the Browser:

• http://192.168.100.9

The Kubernetes server will display the Nginx page.

nginx welcome

Congratulations! You have tested your Kubernetes cluster successfully.