2 min read

Enabling GitOps in k8s with Helm Controller (CRD)

A couple of months ago, while trying to run k8s on a Raspberry Pi at home, I first came in contact with k3s and their neat way to deploy helm charts, which completely fascinated me.

A keychain with a heart and flower, perfect for those seeking strategic and tech accessories.

They call it helm-controller. It was so simple, so… Tiller-less. Back then helm v3 was not around so that was a game-changer. These days, Helm’s Tiller is no longer a problem, however, when you try to automate chart deployments with a pipeline you still need to maintain some state.

If you are not familiar with Rancher’s k3s or helm-controller, I would suggest you take a look at this article first and then (once you are amazed) come back and continue reading this piece.

So, knowing this was possible, I wanted to deploy everywhere in this fashion, but not all flavors of k8s come with a “helm-controller“ right out-of-the-box.

I simply deployed it in my k8s cluster and enjoyed it. However, simple doesn’t necessarily mean easy. I had to work at it a little bit to get it running on my cluster.

Here is how I did it: Note that these steps will deploy RBAC settings, the CRD, and the deployment that watches the CRD in the helm-controller namespace. You probably will need to adjust some settings to your environment.

In this example, I will be deploying bitnami’s nginx chart.

First, deploy the CRD, RBAC, and helm-controller deployment. Verify everything is there. With the helm controller installed let’s deploy the following manifest. This manifest can be downloaded, git cloned, or simply deployed from the web as follows. Let’s check that nginx was effectively deployed. Next, we’ll open that elb address on a web browser.

The chart can easily be updated and deleted using the same manifest, and it can also be patched and edited with regular kubectl magic. Let’s remove the chart now. The helm-controller charts can be easily installed with a gitops approach without maintaining states in the deployer’s host. The manifest also allows us to overwrite the default chart’s values individually or in bulk, using different values.yaml files.

I hope you enjoyed this article.

Innovation starts with a conversation.

Fill out this email form and we’ll connect you with the right person for your needs.