Helm: The Kubernetes Package Manager, Part 2
In the first part of this series, we explored the basics of Helm. Now, in Part 2, we’ll create our own Helm chart for an Express.js application that we previously containerized and deployed to Kubernetes using manifest files.
Step 1: Scaffold A Helm Chart
We start by creating the chart using Helm’s built-in scaffolding tool:
This command generates a Helm chart with default files and folder structure. The structure looks like this:
The default templates include many files, but since we don’t need everything for our simple application, we can clean it up by removing the unnecessary ones.
Step 2: Clean Up Default Templates
We delete , , and from the folder to keep only what we need for our Express app. The remaining files will be , , , and .
Step 3: Configure Deployment.yaml
We define how our application will be deployed in Kubernetes. Here’s our :
Why Use {{ .Values.* }} Syntax?
In Helm templates, refers to values defined in . This allows us to reuse the same chart across environments by simply changing the . It makes the chart dynamic and configurable without changing the template files.
Step 4: Configure Service.yaml
Our service exposes the application inside the cluster:
This is a service that maps external traffic to port on the cluster nodes, which will route it to the port Inside the container.
Step 5: Configure Secret.yaml
We create a Kubernetes secret that stores sensitive information such as API keys, environment variables, etc..:
We can now reference this secret in our deployment using the environment configuration we defined earlier.
Step 6: Add A NOTES.txt
Helm allows us to show helpful output after installation using a file in the templates folder. Here’s our version:
This helps users understand how to access the app after it’s installed.
Step 7: Update values.yaml
We define all dynamic values for the chart here:
This file keeps our configuration DRY and reusable.
Step 8: Package And Install The Helm Chart
Now that our chart is ready, we can package and install it. First, we navigate to the directory where the folder exists:
You should see the output like this
Then, we run:
This generates a file, which is a Helm package. To install the chart into your cluster:
To verify the installation:
To see previously uninstalled or failed releases, add :
To render the template output without installing:
To uninstall the release:
Conclusion
In the second part of this series on Helm, we have explored the basics of Helm and created and installed our own Helm chart.
Thanks for reading.
Data Analyst @Shefra || B.Sc.(Engg.) in MSE
2moThanks for sharing, M. Oly