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.
Install the Docker service.
Enable the Docker service during boot.
Edit the Docker service configuration file.
Add the following configuration at the end of the item named: EXECSTART
Here is the file before our configuration.
Here is the file after our configuration.
Create a System configuration file.
Here is the file content.
Enable the System configuration file.
Edit the configuration file named: MODULES.CONF
Add the following configuration at the end of this file.
Edit the FSTAB configuration file and disable the use of Swap memory.
Here is the file before our configuration.
Here is the file after our configuration.
Set a unique hostname.
Edit the configuration file named HOSTS.
Add an entry to the secondary Kubernetes node.
Create a file to configure the required environment variables.
Here is the file content.
Reboot the computer.
Download and install the Kubernetes repository key.
Add the official Kubernetes repository.
Install the Kubernetes packages.
Download the required Kubernetes images.
Here is the command output.
Initialize the Kubernetes cluster.
Here is the command output.
Take note of the command to add nodes to the Kubernetes cluster.
Set the correct file permission on the Kubernetes configuration file.
Install the required network configuration for PODs.
Install the controller of Ingress.
By default, the Kubernetes master node is not allowed to run PODS.
Optionally, enable the Kubernetes master node to run PODS.
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.
Install the Docker service.
Enable the Docker service during boot.
Edit the Docker service configuration file.
Add the following configuration at the end of the item named: EXECSTART
Here is the file before our configuration.
Here is the file after our configuration.
Create a System configuration file.
Here is the file content.
Enable the System configuration file.
Edit the configuration file named: MODULES.CONF
Add the following configuration at the end of this file.
Edit the FSTAB configuration file and disable the use of Swap memory.
Here is the file before our configuration.
Here is the file after our configuration.
Set a unique hostname.
Edit the configuration file named HOSTS.
Add an entry to the Kubernetes master node.
Reboot the computer.
Download and install the Kubernetes repository key.
Add the official Kubernetes repository.
Install the Kubernetes packages.
Join the Kubernetes cluster.
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.
Congratulations! You have joined the Kubernetes cluster.
Tutorial Kubernetes – Testing the Cluster
On the master node, list the members of the Kubernetes cluster.
Here is the command output.
Create a deployment using the Nginx image.
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.
Here is the command output.
In our example, the POD created is running on the following node: KUBERNETES-02.LOCAL
Scale our deployment to 3 replicas.
Verify the Kubernetes deployment.
Here is the command output.
List the PODs installed on the cluster.
Here is the command output.
In our example, we have 3 PODs running on the following node: KUBERNETES-02.LOCAL
Create a YAML file with the new service configuration.
Here is the file content.
Do not change the YAML file indentation used above.
Install the new Kubernetes service.
Verify the list of Kubernetes services.
Here is the command output.
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.
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.
Congratulations! You have tested your Kubernetes cluster successfully.