How to deploy single node kubernetes with microk8s on ubuntu 20. 04

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.

See also  Ubuntu Weekly Newsletter Issue 786
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

How to deploy single node kubernetes with microk8s on ubuntu 20. 04 1

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

How to deploy single node kubernetes with microk8s on ubuntu 20. 04 2

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

How to deploy single node kubernetes with microk8s on ubuntu 20. 04 3

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

Sponsored
su - $USER

How to deploy single node kubernetes with microk8s on ubuntu 20. 04 4

Step 3: Check Kubernetes status

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

microk8s status --wait-ready

How to deploy single node kubernetes with microk8s on ubuntu 20. 04 5

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

How to deploy single node kubernetes with microk8s on ubuntu 20. 04 6

To enable a particular service, issue the following command:

microk8s enable dashboard dns ingress

How to deploy single node kubernetes with microk8s on ubuntu 20. 04 7

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

How to deploy single node kubernetes with microk8s on ubuntu 20. 04 8

Step 6: Access the Kubernetes dashboard

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

microk8s dashboard-proxy

How to deploy single node kubernetes with microk8s on ubuntu 20. 04 9

Step 7: Start Microk8s

You can start a service by running the following command:

microk8s start

How to deploy single node kubernetes with microk8s on ubuntu 20. 04 10

Step 8: Stop Microk8s

To stop a service, run the following command:

microk8s stop

How to deploy single node kubernetes with microk8s on ubuntu 20. 04 11

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

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.


Discover more from Ubuntu-Server.com

Subscribe to get the latest posts sent to your email.

Comments

No comments yet. Why don’t you start the discussion?

    Leave a Reply