Categories: TutorialsUbuntu

How to Deploy Single Node Kubernetes with Microk8s on Ubuntu 20.04

What is Kubernetes?

Kubernetes is a free, open source, extensible, and portable platform used to manage containerized services and workload in different types of physical, cloud, and virtual environments. It assists in automation and declarative configuration. It has a vast and speedily expanding ecosystem. Kubernetes tools, support, and services are widely available.

Features of Kubernetes:

Following are the features that Kubernetes supports:

Self-healing capabilities

Automated scheduling

Load Balancing

Horizontal Scaling

Automated Rollouts

Environment consistency for development, testing, and production

Auto-scalable infrastructure

Application Centric Management

High Resource utilization

Can create predictable infrastructure

Enterprise ready features and so much more.

In this article, we will look at how to install single node Kubernetes with the help of a few easy to follow commands. To demonstrate the deployment process, we have used Ubuntu 20.04 as the operating system. Ubuntu is a highly efficient and widely used distribution of Linux. Due to its focus on user friendliness, many people use it as a daily driver. It is also the most used distribution in the tech community.

Sponsored

We will install Kubernetes using the command line interface (also known as Terminal).

Without any further ado, let’s get started.

Installation Guide:

Following are the steps involved in the deployment process of Kubernetes on Ubuntu:

Step 1: Install MicroK8s

We first need to install MicroK8s on our Ubuntu system. It is a minimal, lightweight, small, and fully conformant distribution of Kubernetes. We are using snapd package manager to install microk8s.

If you don’t have snapd package manager, you can install it from here:

https://snapcraft.io/docs/installing-snapd?_ga=2.126145930.647748854.1648705733-158347252.1648705733

To install microk8s, we will run the following command:

sudo snap install microk8s --classic

Step 2: Grant admin privileges to your user

Admin privilege is required for seamless usage of commands. For that a group is created, which can be joined using the following commands:

sudo usermod -a -G microk8s $USER

sudo chown -f -R $USER ~/.kube

To update the group, you will have to re-enter the session by executing the command mentioned below:

Sponsored
su - $USER

Step 3: Check Kubernetes status

To check the status of Kubernetes while it is being started, run the following command:

microk8s status --wait-ready

Step 4: Enable the services you want

In this step, we will enable the services we want. To see all the available services and optional features, run this command:

microk8s enable –help

To enable a particular service, issue the following command:

microk8s enable dashboard dns ingress

To disable a service, execute the following command:

Microk8s disable 

Step 5: Begin using Kubernetes

Now that we are done with the essential configurations, let’s start using Kubernetes.

You can make kubectl the default Kubernetes management tool on your terminal if you use microk8s. To do that, type

Alias mkctl=”microk8s kubectl”. You can also manage other Kubernetes clusters with kubectl by pointing to the respective kubeconfig file through the “—kubeconfig” argument.

microk8s kubectl get all --all-namespaces

Step 6: Access the Kubernetes dashboard

To access the Kubernetes dashboard, you can use the following command:

microk8s dashboard-proxy

Step 7: Start Microk8s

You can start a service by running the following command:

microk8s start

Step 8: Stop Microk8s

To stop a service, run the following command:

microk8s stop

In today’s guide, we saw in detail how to install Single Node Kubernetes with microk8s on Ubuntu 20.04. We also explored different commands that are used to configure the Kubernetes instance.

We hope you had a great time exploring the guide.

To learn how to use ‘kubectl get’ with the help of a few examples, do give this page a try:

https://linuxways.net/centos/kubectl-get-command-explained-with-examples/

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications including CCNA RS, SCP, and ACE. As an IT engineer and technical author, he writes for various websites.

Ubuntu Server Admin

Recent Posts

Building RAG with enterprise open source AI infrastructure

One of the most critical gaps in traditional Large Language Models (LLMs) is that they…

4 hours ago

Life at Canonical: Victoria Antipova’s perspective as a new joiner in Product Marketing

Canonical is continuously hiring new talent. Being a remote- first company, Canonical’s new joiners receive…

1 day ago

What is patching automation?

What is patching automation? With increasing numbers of vulnerabilities, there is a growing risk of…

2 days ago

A beginner’s tutorial for your first Machine Learning project using Charmed Kubeflow

Wouldn’t it be wonderful to wake up one day with a desire to explore AI…

3 days ago

Ubuntu brings comprehensive support to Azure Cobalt 100 VMs

Ubuntu and Ubuntu Pro supports Microsoft’s Azure Cobalt 100 Virtual Machines (VMs), powered by their…

3 days ago

Ubuntu Weekly Newsletter Issue 870

Welcome to the Ubuntu Weekly Newsletter, Issue 870 for the week of December 8 –…

4 days ago