At Devunet, we are creating impacts by numbers to our clients, and in this blog, we will share how we reduce our Helm development charts by X time. One of the most used tools in the Kubernetes ecosystem is Helm, and if you are unfamiliar with that tool, I suggest you check out the documentation (https://helm.sh/). Fudmently Helm is a package manager for Kubernetes. Helm charts contain templates and values files that will allow an application to behave differently accordingly to the values file which been provided. The typical helm chart will have between 3–6 template files, and each file can represent service, deployment, secret, configMap, Hpa, ingress, and more. Each one of the files can be changed in a daily/weekly manner, from my experience. Now here is the tricky part, when you have more than five charts that you are maintaining, you are experiencing repetitive work that can result in human error. How Helm help us? A library chart has been introduced on helm3 and can help you to define one centralized template files that you can share among your Helm charts. So how does it work? First of all, you can start by creating a simple helm chart. command: helm create library-chart
Then change the type of the chart from application to library.
Under the library chart, I can use the default template files and edit the template by warping the manifests with “define” which will create a named template.
It’s important to note that the file name should start with ‘_’ so helm will render them as named templates and not as Kubernetes manifest objects.
After we finish setting up the library chart, we can create an application chart that will consume its templates from the library chart.
Then, we will edit the Chart.yaml file and add a dependency to the library chart we created beforehand.
Update the chart dependency.
command: helm dependency build
The dependency build command will add a new file to your application chart folder.
Now we can run the helm template command and see our Kubernetes resources have been created as expected.
command: helm template . To summarize, the Helm library chart is a great feature that can reduce your overhead and development time drastically and achieve faster results in a low time. However, the disadvantage of that kind of approach is that human error can cause issues across all your application microservices, so take the time to test and recheck your changes before propagating them to all of your microservices.