Quick Application Deployments on MicroK8s Using Helm Charts
Helm Charts empower super-quick deployments of complex applications on MicroK8s.
Join the DZone community and get the full member experience.Join For Free
Helm is a Kubernetes package manager that helps you find, share, and use software built for Kubernetes. With Helm Charts, you can bundle Kubernetes deployments into a single package you can install by running a single command.
This article will explain how you can deploy your favorite Helm Chart on MicroK8s in under five minutes.
What Is MicroK8s?
MicroK8s is a lightweight, pure-upstream Kubernetes aiming to reduce entry barriers for K8s and cloud-native application development. It comes in a single package that installs a single-node (standalone) K8s cluster in under 60 seconds. While MicroK8s has all the Kubernetes core components, it is also opinionated, which means that many of the add-ons you would typically look for in Kubernetes, such as DNS, Helm, registry, storage, etc. are all a single command away.
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.
As a first step, let's install MicroK8s on your machine by running the following commands:
Now, let's check whether MicroK8s is up and running or not with the command:
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:
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 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:
Next, enable MetalLB by running:
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. Like we 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.
Bringing Up Our Application
Next, let's create a namespace called logiq for the LOGIQ stack to spin up from and start running with the command:
And then run
helm install with the storage class set to the
microk8s-hostpath as shown below:
values.yml file used in the command above is customized to suit our cluster's configuration.
Our application is now ready to go. Before we launch it, let's inspect the pods in your cluster by running the following command in the
logiq namespace we created:
We can now access our application 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:
Now, using the web browser you love, navigate to the IP address shown by the LoadBalancer service above: http://192.168.1.27:80
And voila! Our LOGIQ deployment on MicroK8s using a Helm Chart is up and running! As you can see, Helm Charts make it much easier to deploy complex applications on Kubernetes clusters. Along with superfast deployments, Helm Charts also help you streamline your CI/CD pipeline by automating various tasks that need to be carried out by default which is why we’re such huge fans of it.
Published at DZone with permission of Ajit Chelat. See the original article here.
Opinions expressed by DZone contributors are their own.