How to deploy microk8s during Ubuntu Server 22.04 installation

Jack Wallen shows you what might be the easiest way to implement microk8s on Ubuntu Server 22.04.

Businessmen implementing document laptops (DMS), online document database.  efficient corporate documents, business business technology automated file management process good for business.
Image: HappyBall3692/Adobe Stock

There are numerous ways to implement Kubernetes. But when your server of choice is Ubuntu Server, the options can be a bit confusing. This is in part because Kubernetes stopped supporting Docker, so getting the pieces up and running can be a challenge.

SEE: Hiring Kit: Back-End Developer (TechRepublic Premium)

However, thanks to microk8s, it’s a bit easier. And, thanks to the Ubuntu Server installation process, getting microk8s up and running is an absolute no-brainer.

Let me show you how it’s done.

What you will need to implement microk8s

All you will need for this is an ISO image of the latest version of Ubuntu Server and a user with sudo privileges. Note, however, that this requires the actual OS to be installed, so you may want to try it out via a virtual machine first. I’m not going to walk you through the entire Ubuntu installation process, but I will focus on adding microk8 during the process.

What is Microk8s?

Before we begin, let’s first discuss microk8s. Microk8s was created by Canonical and is a CNSF-certified upstream Kubernetes implementation that is typically installed as an out-of-the-box package. The nice thing about microk8s is that it packages everything you need (libraries and binaries) to run Kubernetes services.

I will mention though that while Microk8s is a great way to start developing for Kubernetes, it can also be bundled and used for deployments at scale, making it one of the best paths to Kubernetes on the market.

With that said, let’s move on to implementation.

How to add microk8s to your Ubuntu Server installation

Go ahead and start the installation of Ubuntu Server as you normally would. You’ll eventually find yourself on a page labeled Featured Server Snaps (Figure A).

Figure A

The Featured Server Snapshots page of the Ubuntu Server installation.

Navigate to microk8s and select it to install using the space bar on your keyboard. You can also browse the list and add any other servers and services you want. Once you’ve taken care of that, scroll down to Done and press Enter on your keyboard. This will finish the installation.

When prompted, reboot the server or virtual machine and remove the installation media.

How to finish the installation

You’re not done yet. Once the server restarts, log in so I can take care of the final steps. The first thing you need to do is add your user to the microk8s group with the command:

sudo usermod -aG microk8s $USER

Log out and log back in for the changes to take effect.

Finally, you need to change ownership of the ~/.kube directory with the command:

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

You can then test the installation with the command:

microk8s kubectl get nodes

You will only see one node in the list (the machine you are logged into), indicating that the Microk8s installation was successful.

Subscribe to TechRepublic’s How To Make Tech Work on YouTube to get the latest tech tips for business professionals from Jack Wallen.

Leave a Comment