How has the recent turmoil within the OpenAI offices changed your plans to use GPT in a business process or product in 2024?
Increased uncertainty means we are more likely to evaluate alternative AI chatbots and LLMs.
No change in plans, though we will keep an eye on the situation.
With Sam Altman back in charge, we are more likely to go all-in with GPT and LLMs.
What recent turmoil?

Kubernetes 101: Deploy Portainer to a MicroK8s Cluster

With the help of MicroK8s, you can deploy Portainer in such a way as to make managing Kubernetes exponentially easier.
Dec 31st, 2022 6:00am by
Featued image for: Kubernetes 101: Deploy Portainer to a MicroK8s Cluster

Portainer is a powerhouse container management platform that is not only perfectly at home with Docker deployments but with Kubernetes environments as well. However, as anyone who’s ever dealt with Kubernetes will tell you…it’s hard. Given how many moving pieces are to be had with a Kubernetes cluster, unless you really know what you’re doing, you’ll find managing such an environment can be an absolute nightmare.

Thankfully, there are GUIs like Portainer that go a very long way to simplify your Kubernetes experience. Yes, you still have to have an understanding of how Kubernetes works — you need to know about namespaces, pods, networks, applications, ingresses, and much more. Imagine having a web-based GUI to clear away some of that confusion so you can actually get to the important part…deploying your applications and services.

That’s what Portainer does and with the help of MicroK8s, you can deploy Portainer in such a way as to make managing Kubernetes exponentially easier.

Let me show you how.


To make this work, you’ll need at least three machines running Ubuntu Server 22.04 (because that’s my go-to server distribution). Yes, you can do this on another Linux distribution, but you’ll need to modify the installation procedure. The steps for deploying MicroK8s and Portainer are the same, so once you get beyond the MicroK8s installation, everything here will work as it stands.

Step 1: Install MircoK8s

The first thing we must do is install MicroK8s. There is, however, a trick. Portainer will not work with any version of MicroK8s earlier than 1.24. To add to that issue, I’ve found versions later than 1.24 don’t reliably cluster. Because of that, we’ll install version 1.24 of MicroK8s. Here are the steps.

Edit the Hosts Files

The first thing you’ll want to do is edit the host files on all three machines. To open the file for editing, issue the command:

At the bottom of that file, add the following (making sure to use your IP addresses and hostnames):

Save and close the file. Make sure you edit the hosts file the same way on all three machines.

Change the Hostnames

You’ll also need to change the hostname for each machine. We’ll stick with our convention above. On each machine, you’ll run a command like this:

Do the same thing on each machine, using k8s2, and k8s3 as the other hostnames. Once you’ve done that, log out of each machine and log back in.

Set the Correct Timezone

You will also need to make sure all machines are on the same (correct) timezone. For this, you’ll run a command like this:

Make sure to substitute America/Kentucky/Louisville for your timezone, which can be found with the command:

Install MicroK8s

MicroK8s can be easily installed on Ubuntu Server with snap. On each machine, you’ll issue the command:

Next, add your user to the MicroK8s group with:

Log out and log back in.

Finally, change the ownership of the .kube folder with:

With MicroK8s installed on all three machines, you’re ready to create the cluster.

Cluster Your Machines

On the controller (k8s1), issue the command:

The output will include the join command that you will run on all your nodes. The command will look something like this:

Back on the controller, verify the nodes have successfully joined with the command:

The output should look something like this:

You’re now ready to deploy Portainer to the cluster.

Deploying Portainer to the MicroK8s

On the controller you must first enable a few add-ons, which can be done with the following commands:

Next, you must enable the MicroK8s community repository with the command:

Finally, you can enable Portainer with:

Give Portainer a minute or so to finish deploying. To check on the status of Portainer, issue the following command:

Once Portainer is listed in a running state, open your default web browser and point it to either http://SERVER:30777 or https://SERVER:30799 (where SERVER is the IP address or domain of the hosting server).

Portainer will prompt you to create a new admin user. Once you’ve done that, make sure to select the local environment and you’ll then be greeted by the Portainer Dashboard (Figure 1), clearly showing you have a Kubernetes environment to work with.

Figure 1: Portainer is now ready for your first Kubernetes deployment.

And that’s all there is to deploying the Portainer management platform for a Kubernetes environment. Thanks to MicroK8s, this is a great way to get up to speed with Kubernetes without being overwhelmed by too many commands or the nightmare that can be deploying Kubernetes itself.

Group Created with Sketch.
TNS owner Insight Partners is an investor in: Docker.
THE NEW STACK UPDATE A newsletter digest of the week’s most important stories & analyses.