906d6f19 dad8 415a 9f70 072bc50d9080

How to Package and Distribute Helm

Spread the love

At the end of this guide, you can package and distribute your Helm package. But before going into the details of packaging a Helm Chart, let’s do some introduction

What is Helm?

Helm is a package management tool for Kubernetes applications. It makes it easier and more efficient to bundle and deploy Kubernetes manifest files and redistribute them. You can read more about Helm in our introductory article.

How to Create a Simple Helm Chart

To create a simple Helm Chart you need first to have the binary installed in your terminal, you can use the installation instructions from the official website of Helm.

When Helm is installed and running in your local machine then run the following command to initialize the Helm Chart.

helm create mychart

This command will generate a helm chart with default configurations in it

Understand the Components of a Helm Chart

A Helm Chart is made up of different components;

– Template Folder: which contains Kubernetes Manifest files

– Values File: This is used to pass parameters to the Manifest files in the template

– Chart.yaml file: Describe the name, version, and other metadata information about the chart.

– _helpers.tpl file: Defines variables that is reasonable across the chart and manifest files

Each of these components plays a role in the packaging process. When the chart is initialized, it is neither distributable nor reusable because the helm install command only recognizes a Helm package in the form of a .tgz bundle. Attempting to install it directly will not work. Now, let’s discuss how to package the chart.

Packaging a Helm Chart

To package a chart, we use the Helm CLI to create a .tgz file. This makes the chart a distributable application. Before running the command ensure you are in the root directory of the Helm chart. Then run the following command:

helm package .

This will create a .tgz file with all the components that existed in the Helm Chart. Now that we have the package, we have to make a redistributable.

Create an Index for the Package

When the Helm package has been created, an index needs to be generated for the Helm CLI to locate the remote location of the package. The package is usually stored in a remote storage system. Use the following command to create the chart index

helm repo index . –url https://example.com/mychart-1.0.0.tgz

This creates an index.yaml file with configurations on how Helm will locate the package in the remote repo.

Making the Package Distributable

This simply means putting the .tgz packaged file into a distributable storage engine or service such as Git Release, Amazon S3, GCS, or the opensource ChartMuseum

When it is in a distributed storage then you can easily run the commands for deploying it and reusing it

helm repo add mychart https://example.com

helm install myapp appone/mychart

The best approach to packaging a Helm chart will be to automate all the steps mentioned. Using Github Actions can be fast because these steps have been bundled into an action in the Github marketplace. If you use a CI tool that is not Github Actions, you can still automate this process by adding each script step to your CI workflow

Conclusion

These steps allow you to package a Helm chart to make it distributable and reusable. Having a Helm Chart packaged.

If you love using Helm Chart for deployment and want to stop using multiple Helm Charts for all your app deployments, check out my Mono Chart repo here and the article here that explains it all


Spread the love

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top
×