Jack Wallen shows you what might be the easiest method of deploying microk8s on Ubuntu Server 22.04.
There are numerous ways to deploy Kubernetes. But when your server of choice is Ubuntu Server, the options can be a bit confusing. This is in part because Kubernetes dropped support for Docker, so getting the pieces up and running can be a bit of 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’ll need to deploy microk8s
The only thing you’ll need for this is an ISO image of the latest version of Ubuntu Server and a user with sudo privileges. Do note, however, that this does require the installation of the actual OS, so you might want to first test this via a virtual machine. I’m not going to walk you through the entire Ubuntu installation process but will focus on the addition of microk8s 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 deployment normally installed as a snap package. The nice thing about microk8s is that it packages together everything you need — libraries and binaries — to run the Kubernetes services.
I will mention, however, that although Microk8s is a great way to get started developing for Kubernetes, it can also be clustered together and used for at-scale deployments, making it one of the best routes to Kubernetes on the market.
With that said, let’s get to the deployment.
How to add microk8s to your Ubuntu Server install
Go ahead and begin the installation of Ubuntu Server as you normally would. You will eventually find yourself on a page labeled Featured Server Snaps (Figure A).
Navigate to microk8s and select it for installation using the space bar on your keyboard. You can also skim through the list and add any other servers and services you might want. Once you’ve taken care of that, tab down to Done and hit Enter on your keyboard. This will finish up the installation.
When prompted, reboot the server or virtual machine and remove the installation media.
How to finish up the installation
You’re not done just yet. Once the server reboots, log in so you can take care of the final steps. The first thing you must do is add your user to the microk8s group with the command:
sudo usermod -aG microk8s $USER
Log out and log back in so the changes will take effect.
Finally, you must change the 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 listed (the machine you’re logged into), indicating the installation of Microk8s was a success.
Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.