Containers, Kubernetes, and IoT/edge applications are playing an extremely important role in enterprise digital transformation. They are especially important for DevOps teams working to accelerate software releases and improve IT operations through integration and optimization. The majority of cloud-native software is user-friendly, allowing many developers to contribute and customize the relevant software. This has resulted in simplified Kubernetes versions with small footprints that are ideal for IoT/edge tasks.

MicroK8s creates a certified Kubernetes cluster from a single node in minutes. Canonical’s Microk8s Kubernetes distribution is small, versatile, and lightweight  It’s an uncluttered distribution with an emphasis on improving performance and usability. Microk8s can usually be configured in IoT and edge devices due to their small size.

MicroK8s is designed to run on any Linux distribution. It’s thin and compact, deploying all Kubernetes services on Ubuntu while also including all of the necessary libraries. Because of its tiny footprint, it’s ideal for tablets, desktops, CI pipelines, IoT cameras, and small edge clouds.

Pre-requisites

  • Ubuntu 20.04 LTS or any other version of Ubuntu.
  • A stable internet connection
  • Sudo privileges

Installation of Microk8s on Ubuntu 20.04 LTS

For installing Microk8s on Ubuntu 20.04 LTS, open the terminal by using the shortcut key as “CTRL ALT T”. As soon as you see the terminal screen of Ubuntu, follow the listed basic steps for installation.

Step 1: Install Microk8s using snap package

MicroK8s is released as a snap, which necessarily involves the installation of snapd. This is already included in the most recent Ubuntu version. To have the most recent version of MicroK8s, type the following command:

:~$ sudo snap install microk8s –classic

As soon as you execute the command in the terminal, you will see that it will start downloading microk8s.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/05/echo/Install-Kubernetes-Ubuntu-single-node-01.png" data-lazy- height="295" src="data:image/svg xml,” width=”974″>

Depending upon your internet speed, the installation will be accomplished, and on your terminal, you will see a message indicating that the installation was successful.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/05/echo/Install-Kubernetes-Ubuntu-single-node-02.png" data-lazy- height="106" src="data:image/svg xml,” width=”974″>

From the above-displayed image, you can check that v1.20.5 has been installed on your Ubuntu 20.04 LTS.

Step 2:  List different versions of Microk8s on your Ubuntu 20.04

To list all available versions of miccrok8s, you can use the following snap command.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/05/echo/Install-Kubernetes-Ubuntu-single-node-03.png" data-lazy- height="629" src="data:image/svg xml,” width=”974″>

As soon as you execute the command mentioned above, you will see different versions of Microk8s displayed on your Ubuntu 20.04 terminal.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/05/echo/Install-Kubernetes-Ubuntu-single-node-04.png" data-lazy- height="712" src="data:image/svg xml,” width=”974″>

Step 3: View Status of installed Microk8s

After installation, you have to check the status of installed microk9s. The status of MicroK8s can be viewed using an already built-in command available in Ubuntu 20.04. For this specific purpose, you have to execute the below-mentioned command in your terminal simply.

:~$ microk8s status –wait-ready

Note: You have to write the “–wait-ready” flag during installation to wait for  services of the Kubernetes to get started:

During the execution of this command, it is suggested not to quit the terminal and wait for the Kubernetes to start their services.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/05/echo/Install-Kubernetes-Ubuntu-single-node-05.png" data-lazy- height="606" src="data:image/svg xml,” width=”974″>

You can see that microk8s is running, and it is available for further work.

Step 4: Accessing Kubernetes

Now it is the most important step to access Kubernetes. For accessing Kubernetes, MicroK8s includes its edition of kubectl. It can be used to operate commands that will track and manage your Kubernetes cluster. If you want to view your current node, you must execute the following specified command in the terminal.

:~$ microk8s kubectl get nodes

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/05/echo/Install-Kubernetes-Ubuntu-single-node-06.png" data-lazy- height="77" src="data:image/svg xml,” width=”974″>

From the above-displayed image, you can view that the status is “Ready”. You can also view the Name, roles, age, and version of the node by executing this command.

Step 5: View Running services

If you want to view the running services of microk8s, you can check it by the following below-mentioned command:

:~$ microk8s kubectl get services

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/05/echo/Install-Kubernetes-Ubuntu-single-node-07.png" data-lazy- height="72" src="data:image/svg xml,” width=”974″>

You can see the name, type, Cluster-ip, external-ip, port(s), and age of the running services by executing this command.

Step 6: Deployment of the application using mickro8s

Kubernetes is a container management system for deploying applications and services. In the below-mentioned example, we are deploying an application of Ngnix by using kubectl. You can deploy any other app by using the same command. The most vital point is to replace your desired application name with Ngnix.

Type this command for the successful deployment of Ngnix:

:~$ microk8s kubectl create deployment nginx –image=nginx

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/05/echo/Install-Kubernetes-Ubuntu-single-node-08.png" data-lazy- height="72" src="data:image/svg xml,” width=”974″>

From the image shown above, you can see that application has been deployed.

Step 7: Check the version of kubectl

To verify the successful installation of Kubernetes, you can check its version by typing the below-mention command in the terminal.

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/05/echo/Install-Kubernetes-Ubuntu-single-node-09.png" data-lazy- height="124" src="data:image/svg xml,” width=”974″>

Additional Commands

If you are confused in writing different commands related to kubectl, you can check some basic commands of kubectl by executing the following command:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/05/echo/Install-Kubernetes-Ubuntu-single-node-10.png" data-lazy- height="625" src="data:image/svg xml,” width=”974″>

Conclusion

Finally, you are done with the installation of Kubernetes on Ubuntu 20.04 single node. In this guide, we tried our best to explain all the steps that are essentially required for the installation. However, we also teach you about the deployment of applications in Kubernetes using kubectl.

About the author

<img alt="Avatar" data-lazy-src="https://secure.gravatar.com/avatar/d014e3711df41253029f4d4199698df8?s=112&r=g" height="112" src="data:image/svg xml,” width=”112″>

Kalsoom Akhtar

Hello, I am a freelance writer and usually write for Linux and other technology related content