Using Microk8s to Deploy Single Node Kubernetes on Ubuntu 22.04 (Jammy Jellyfish) - Step by step guide ?

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.

Here at LinuxAPT, we shall look into how to install single node Kubernetes via Microk8s on Ubuntu.

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

https://linuxapt.com/blog/1300-kubectl-get-command-explained-with-examples


Main features of Kubernetes includes:

  • 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.


Steps to install and deploy Kubernetes on Ubuntu

1. Install MicroK8s

To begin, we will install MicroK8s (a minimal, lightweight, small, and fully conformant distribution of Kubernetes) on our Ubuntu system.

We can use 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


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:

$ su - $USER


3. Check Kubernetes status

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

$ microk8s status --wait-ready


4. Enable the services you want

Now, 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 <name>


5. Test 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


6. Access the Kubernetes dashboard

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

$ microk8s dashboard-proxy


7. Start Microk8s

You can start a service by running the following command:

$ microk8s start


8. Stop Microk8s

To stop a service, run the following command:

$ microk8s stop


[Need help in fixing Linux System issues ? We can help you. ]

This article covers how to install Single Node Kubernetes with microk8s on Ubuntu 22.04. In fact, you will see the different useful commands to configure the Kubernetes instance.

Related Posts