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

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

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

Kubernetes – Tutorials

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

Tutorial Kubernetes – Installation on Ubuntu Linux

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

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 – Testing the Cluster

This is a single node cluster.

Enable the Kubernetes master to run PODS.

Copy to Clipboard

Create a POD using the Nginx image.

Copy to Clipboard

In our example, we created a POD named TEST.

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

Copy to Clipboard

Here is the command output.

Copy to Clipboard

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 POD using the NGINX image.

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

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

Use the CURL command to test the communication to the POD running Nginx.

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.