Creating A Helm Chart Template: A Step by Step Guide

Last updated
April 18, 2024
Cortney Nickerson
Developer Advocate

Table of Contents

No items found.

Try Monokle Desktop Today

A Guided Voyage into Helm Charts: Your Kubernetes Compass

In the vast oceans of software deployment, where microservices, containers, and cloud-native architectures reign, navigating the turbulent waters can be a daunting task. Enter Helm, the swiss-army knife of Kubernetes, here to guide sailors – both novice and seasoned – through the complex archipelago of deploying, managing, and scaling applications. Helm charts, akin to the treasured maps of old, offer a structured pathway to deploy applications on Kubernetes, making the journey smoother and less error-prone.

Whether you're just docking your ship in the harbor of Kubernetes or have sailed these seas many times before, understanding Helm charts is essential. These charts encapsulate application configurations, making installations a breeze. In this article, we'll embark on a step-by-step expedition, crafting our very own Helm chart, ensuring that by journey's end, you'll have a treasured map of your own. So hoist the anchor and set sail across the world of Helm charts!

1. Setup Environment:

  - Ensure you have Helm CLI installed.

  - Ensure you have access to a Kubernetes cluster (e.g., Minikube or any cloud-based Kubernetes service).

2. Create a New Chart:

  This command creates a directory called `mychart` with the basic structure of a chart inside.

3. Directory Structure:

  Here's a brief overview of the generated directory:

  - `Chart.yaml`: The metadata about the chart.

  - `values.yaml`: The default values for the chart’s templates.

  - `templates/`: The directory containing template files.

  - `templates/NOTES.txt`: A plain text file containing short usage notes.

4. Modify the `Chart.yaml`:

  Open `Chart.yaml` and update metadata like `name`, `version`, `description`, etc.

5. Update the Templates:

  Helm uses a combination of the Go programming language's templating system and Sprig functions. The `templates/` directory contains files that are converted to Kubernetes manifest files when the chart is installed.

Modify the YAML files in the `templates/` directory to represent the Kubernetes objects you need.

6. Using Values:

  In the `values.yaml` file, you can define variables. These variables can be used within your templates. For instance, in `values.yaml`:


Can be referenced in a template as:

7. Install the Chart:

  Test your chart by installing it:

  This installs the `mychart` directory as a release named `my-release-name`.

8. Test Your Deployments:

  After installing the chart, check if all resources have been created and are running:

9. Packaging the Chart:

  Once you're satisfied with the chart, you can package it:

  This produces a `.tgz` file.

10. Sharing the Chart:

  You can then push your chart to a Helm chart repository or share the `.tgz` file.

11. Cleanup:

  If you wish to delete the deployed release:

There's the basics! Keep in mind, Helm charts can range from the simple, like we covered above, to the complex. When you run into complexities, remember that there are advanced use cases and documentation for more in-depth details.

About Monokle

Monokle helps you achieve high-quality Kubernetes deployments throughout the entire application lifecycle—from code to cluster. It enables your team to define Kubernetes configuration policies to ensure consistent, secure, and compliant application deployments every time. In addition to policy enforcement, Monokle’s ecosystem of tools make your team’s daily YAML configuration workflows easier. Get started with Monokle for free.