Run your favorite Helm Chart using MicroK8s in 5 minutes

This article will explain how you can deploy your favorite Helm Chart on MicroK8s in under 5 minutes.

What is MicroK8s?

What is LOGIQ?

LOGIQ is a complete observability platform for monitoring, log aggregation, and analytics with an infinite storage scale that aims to bring simple and powerful logging to the masses. LOGIQ uses AWS S3 (or S3-compatible storage) for data at rest and allows the sending of logs from Kubernetes, on-prem servers, or cloud VMs with ease.

The LOGIQ platform includes:

  • A User Interface (UI)
  • A command-line toolkit
  • A monitoring stack for time-series metrics, and;
  • A log analytics stack for log data.

Now that you’re acquainted with MicroK8s and LOGIQ and their awesomeness, why don’t we jump right into the integration?

The Setup

In this demo, we’ll use the logiq Helm Chart. You can also use your own favorite Helm Chart that you’d like to try out. Let’s also assume that you have access to the Linux operating system.

Installing MicroK8s

As a first step, let’s install MicroK8s on your machine by running the following commands:

sudo apt-get -y update
sudo snap install core
sudo snap install microk8s --classic
sudo usermod -a -G microk8s $USER
sudo chown -f -R $USER ~/.kube
sudo microk8s config > ~/.kube/config

Now, let’s check whether MicroK8s is up and running or not with the command:

sudo microk8s status

Enabling add-ons

Now that we have MicroK8s up and running, let’s set up your cluster and enable the add-ons that MicroK8s readily provides, like Helm, DNS, ingress, storage, and private registry. These add-ons can be enabled and disabled at any time, and most are pre-configured to work without any additional setup.

Run the following commands to enable add-ons:

microk8s enable helm
microk8s enable storage
microk8s enable dns
microk8s enable ingress
microk8s enable registry
microk8s.kubectl config view > $HOME/.kube/config

Provisioning an IP address

We need an endpoint or an IP address to access the application we’re spinning up. This endpoint can either be within or outside our cluster. For this, let’s leverage MetalLB – a Kubernetes-aware solution that can monitor for services with the type LoadBalancer and assign them an IP address. Alternatively, you can also set an IP address while enabling add-ons.

While provisioning an IP address, you can use your local machine’s IP address, which pulls up the stack at IP-address:80. If you do not know your local machine’s IP address, run the ifconfig command as shown below and use the output of the command:

ifconfig:
wlp60s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.27 netmask 255.255.255.0 broadcast 192.168.1.255

Next, enable MetalLB by running:

microk8s enable metallb
Enabling MetalLB
Enter each IP address range delimited by comma (e.g. '10.64.140.43-10.64.140.49,192.168.0.105-192.168.0.111'): 192.168.1.27-192.168.1.27

Note: If you’re spinning up an EC2 instance from AWS, MetalLB might not work due to private/public IP configuration. We’ll take a closer look at and resolve this issue in another article.

Bring in the Helm Chart

Now that the configuration bits are in place, it’s time to bring in your Helm Chart. As mentioned above, we’re using the logiq Helm Chart and Helm 3 in the following commands. You can replace the Helm Chart repo URL in the following command with your own Helm Chart’s repo URL if you’re trying another chart.

Run:

helm repo add logiq-repo https://logiqai.github.io/helm-charts
helm repo update

Bringing up LOGIQ

Next, let’s create a namespace called logiq for the stack to spin up from and start running with the command:

microk8s kubectl create namespace logiq

And then run helm install with the storage class set to the microk8s-hostpath as shown below:

helm install logiq -n logiq --set global.persistence.storageClass=microk8s-hostpath logiq-repo/logiq -f values.yaml  --debug --timeout 10m

Note: The values.yml file used in the command above is customized to suit our cluster’s configuration. You can download the values.yml file from docs.logiq.ai and edit it to suit your cluster’s needs, and then run the above command.

LOGIQ is now ready to go! Before we get to the UI, let’s inspect the pods in your cluster by running the following command in the logiq namespace you created:

microk8s kubectl get pod -n logiq

We can now access the LOGIQ UI by hitting the MetalLB endpoint we defined earlier in this article. To find the endpoint, let’s search for the LoadBalancer service that knows which IP address MicroK8s exposes.

Run the command:

$microk8s kubectl get service -n logiq |grep -i loadbalancer
logiq-kubernetes-ingress  LoadBalancer   10.152.183.45  192.168.1.27

80:30537/TCP,20514:30222/TCP,24224:30909/TCP,24225:31991/TCP,2514:30800/TCP,3000:32680/TCP,514:32450/TCP,7514:30267/TCP,8081:30984/TCP,9998:31425/TCP     18m

Now, using a web browser of your choice, navigate to the IP address shown by the LoadBalancer service above: http://192.168.1.27:80

And voila! Our LOGIQ deployment using a Helm Chart is up and running!

On a side note, we wanted to talk about how cumbersome logging is. Most of the logging solutions out there hold data in proprietary databases that use disks and volumes to store their data. What’s wrong with that, you ask? Well, disks and volumes need to be monitored, managed, replicated, and sized. Throw in clustering in the mix and your log analytics project is now working on someone else’s software and is a storage nightmare. For these reasons, we built the LOGIQ observability platform – to bring easy logging to everyone who needs it. Using LOGIQ, you can ingest log data from Kubernetes, on-prem servers or cloud VMs, applications, and several other data sources, helping you gain complete visibility over your infrastructure and applications without burning a massive hole in your pocket.

We love making logging easy. To show you how easy it is to get going with the LOGIQ platform, our next article will show you how to automate the LOGIQ platform’s deployment on AWS using Helm Charts on MicroK8s using a CloudFormation template. Meanwhile, if you have questions about LOGIQ and would like to know more, please do leave a comment below or visit our website and reach out!

27