Wednesday, November 29, 2023
HomeVideo EditingKubernetes 101: Deploy Portainer to a MicroK8s Cluster

Kubernetes 101: Deploy Portainer to a MicroK8s Cluster


Portainer is a powerhouse container administration platform that isn’t solely completely at dwelling with Docker deployments however with Kubernetes environments as properly. Nonetheless, as anybody who’s ever handled Kubernetes will inform you…it’s laborious. Given what number of transferring items are available with a Kubernetes cluster, until you actually know what you’re doing, you’ll discover managing such an surroundings could be an absolute nightmare.

Fortunately, there are GUIs like Portainer that go a really lengthy solution to simplify your Kubernetes expertise. Sure, you continue to must have an understanding of how Kubernetes works — you must find out about namespaces, pods, networks, purposes, ingresses, and way more. Think about having a web-based GUI to clear away a few of that confusion so you may really get to the necessary half…deploying your purposes and providers.

That’s what Portainer does and with the assist of MicroK8s, you may deploy Portainer in such a method as to make managing Kubernetes exponentially simpler.

Let me present you ways.

Necessities

To make this work, you’ll want not less than three machines operating Ubuntu Server 22.04 (as a result of that’s my go-to server distribution). Sure, you are able to do this on one other Linux distribution, however you’ll want to switch the set up process. The steps for deploying MicroK8s and Portainer are the identical, so when you get past the MicroK8s set up, every little thing right here will work because it stands.

Step 1: Set up MircoK8s

The very first thing we should do is set up MicroK8s. There may be, nevertheless, a trick. Portainer is not going to work with any model of MicroK8s sooner than 1.24. So as to add to that subject, I’ve discovered variations later than 1.24 don’t reliably cluster. Due to that, we’ll set up model 1.24 of MicroK8s. Listed here are the steps.

Edit the Hosts Recordsdata

The very first thing you’ll wish to do is edit the host information on all three machines. To open the file for enhancing, subject the command:

On the backside of that file, add the next (ensuring to make use of your IP addresses and hostnames):

Save and shut the file. Be sure you edit the hosts file the identical method on all three machines.

Change the Hostnames

You’ll additionally want to vary the hostname for every machine. We’ll follow our conference above. On every machine, you’ll run a command like this:

Do the identical factor on every machine, utilizing k8s2, and k8s3 as the opposite hostnames. When you’ve achieved that, sign off of every machine and log again in.

Set the Appropriate Timezone

Additionally, you will want to ensure all machines are on the identical (appropriate) timezone. For this, you’ll run a command like this:

Ensure to substitute America/Kentucky/Louisville on your timezone, which could be discovered with the command:

Set up MicroK8s

MicroK8s could be simply put in on Ubuntu Server with snap. On every machine, you’ll subject the command:

Subsequent, add your person to the MicroK8s group with:

Sign off and log again in.

Lastly, change the possession of the .kube folder with:

With MicroK8s put in on all three machines, you’re able to create the cluster.

Cluster Your Machines

On the controller (k8s1), subject the command:

The output will embody the be part of command that you’ll run on all of your nodes. The command will look one thing like this:

Again on the controller, confirm the nodes have efficiently joined with the command:

The output ought to look one thing like this:

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

Deploying Portainer to the MicroK8s

On the controller you should first allow a number of add-ons, which could be achieved with the next instructions:

Subsequent, you should allow the MicroK8s group repository with the command:

Lastly, you may allow Portainer with:

Give Portainer a minute or so to complete deploying. To test on the standing of Portainer, subject the next command:

As soon as Portainer is listed in a operating state, open your default internet browser and level it to both http://SERVER:30777 or https://SERVER:30799 (the place SERVER is the IP tackle or area of the internet hosting server).

Portainer will immediate you to create a brand new admin person. When you’ve achieved that, make certain to pick the native surroundings and also you’ll then be greeted by the Portainer Dashboard (Determine 1), clearly displaying you could have a Kubernetes surroundings to work with.

9964da1b portainermicrok8s1

Determine 1: Portainer is now prepared on your first Kubernetes deployment.

And that’s all there may be to deploying the Portainer administration platform for a Kubernetes surroundings. Due to MicroK8s, it is a nice solution to stand up to hurry with Kubernetes with out being overwhelmed by too many instructions or the nightmare that may be deploying Kubernetes itself.

Group Created with Sketch.
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments