Kubernetes Package Management: The Ultimate Helm Guide

Deep dive into Helm's core components (Chart/Repository/Release) for streamlined Kubernetes application deployment. Includes installation steps and template creation workflow.

This article was published 429 days ago, some content may be outdated. If you have any questions, please leave a comment.

Introduction

image-20250114165558995

Helm is a powerful tool for managing Kubernetes applications. Through Helm Charts, you can define, install, and upgrade even the most complex Kubernetes applications.

Helm Charts are easy to create, version control, share, and publish. This means you can use Helm more efficiently, avoiding the tedious process of manually copying and pasting configuration files.

Helm has graduated from CNCF (Cloud Native Computing Foundation) and is continuously maintained by the Helm community, ensuring its stability and ongoing development.

  • Managing Complexity

    Helm Charts can describe even the most complex applications, providing reproducible installation workflows and serving as the single source of truth for application configuration to ensure consistency and reliability.

  • Easy Updates

    With Helm, you can effortlessly manage application updates through in-place upgrades and custom hooks, minimizing disruptions caused by updates.

  • Simple Sharing

    Helm Charts are easy to version control, share, and host on public or private repositories, facilitating team collaboration and application distribution.

  • Rollbacks

    If issues arise during updates, the helm rollback command allows you to easily revert to a previous release version, ensuring stable application operation.

Helm’s Workflow

The workflow of Helm can be understood as follows:

  • Install Charts: Helm installs Charts into a Kubernetes cluster, creating a new Release each time.
  • Manage Releases: Each Release is independently managed, allowing the same Chart to be deployed multiple times to meet different requirements.
  • Find Charts: Charts can be found and obtained through Helm’s Chart Repository, allowing for new Charts to be deployed.

Overall Diagram Representation:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
+---------------------+          +---------------------+
|    Chart Repository | <------> |        Helm         |
| (Store all Charts)    |          | (Install and Manage Charts)   |
+---------------------+          +---------+-----------+
                                         |
                                         v
                               +--------------------+
                               | Kubernetes Cluster |
                               | ------------------ |
                               | Release A          |
                               | Release B          |
                               | ...                |
                               +--------------------+

Three Core Concepts

Chart

Chart is a Helm package. It contains all the resource definitions required to run an application, tool, or service in a Kubernetes cluster. It can be compared to the Kubernetes version of Homebrew recipes, dpkg, or RPM files in Apt or Yum.

Diagram Representation:

1
2
3
4
5
6
7
8
+-----------------+
| Chart           |
| --------------- |
| Deployment.yaml |
| Service.yaml    |
| ConfigMap.yaml  |
| ...             |
+-----------------+

Helm will deploy the Chart in the following order:

Namespace —> NetworkPolicy —> ResourceQuota —> LimitRange —> PodSecurityPolicy —> PodDisruptionBudget —> ServiceAccount —> Secret —> SecretList —> ConfigMap —> StorageClass —> PersistentVolume —> PersistentVolumeClaim —> CustomResourceDefinition —> ClusterRole —> ClusterRoleList —> ClusterRoleBinding —> ClusterRoleBindingList —> Role —> RoleList —> RoleBinding —> RoleBindingList —> Service —> DaemonSet —> Pod —> ReplicationController —> ReplicaSet —> Deployment —> HorizontalPodAutoscaler —> StatefulSet —> Job —> CronJob —> Ingress —> APIService

Repository

Repository is a collection of Charts. It can be compared to the Apt or Yum repository.

Diagram Representation:

1
2
3
4
5
6
7
+---------------------+
| Chart Repository    |
| ------------------- |
| Chart A     Chart B |
| Chart C     Chart D |
| ...                 |
+---------------------+

Release

Release is a running instance of a Chart. A Chart can be installed multiple times in a Kubernetes cluster, each with its own Release. For example, if you have a MySQL Chart, you can install it twice in the same cluster, each with its own Release.

Diagram Representation:

1
2
3
4
5
6
7
+------------------+       +------------------+
| Release A 	   |       | Release B        |
|------------------|       |------------------|
| MySQL Chart      |       | MySQL Chart      |
| Release Name: A  |       | Release Name: B  |
| ...              |       | ...              |
+------------------+       +------------------+

Installation

Each release of Helm provides binary releases for a variety of OSes. These binary versions can be manually downloaded and installed.

  1. Download your desired version
  2. Unpack it (tar -zxvf helm-v3.0.0-linux-amd64.tar.gz)
  3. Find the helm binary in the unpacked directory, and move it to its desired destination (mv linux-amd64/helm /usr/local/bin/helm)

Create Project Templates

Create a Helm project template using the command:

1
helm create mychart

This generates the following files and directory structure:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
.
β”œβ”€β”€ charts                          # Directory for dependency Charts
β”œβ”€β”€ Chart.yaml                      # Metadata describing the Chart
β”œβ”€β”€ templates                       # Directory for template files
β”‚Β Β  β”œβ”€β”€ deployment.yaml             # Deployment template
β”‚Β Β  β”œβ”€β”€ _helpers.tpl                # Helper templates
β”‚Β Β  β”œβ”€β”€ hpa.yaml                    # Horizontal Pod Autoscaler template
β”‚Β Β  β”œβ”€β”€ ingress.yaml                # Ingress template
β”‚Β Β  β”œβ”€β”€ NOTES.txt                   # Installation notes
β”‚Β Β  β”œβ”€β”€ serviceaccount.yaml         # Service Account template
β”‚Β Β  β”œβ”€β”€ service.yaml                # Service template
β”‚Β Β  └── tests                       # Test templates
β”‚Β Β      └── test-connection.yaml    # Connection test template
└── values.yaml                     # Default values overriding template parameters

Summary

Helm simplifies the deployment and management of applications, tools, and services in Kubernetes clusters through three core concepts:

  • Charts: Define applications
  • Repositories: Enable sharing and distribution of Charts
  • Releases: Manage running instances of these applications in clusters

The charts provide application definitions, repositories facilitate sharing, and releases handle the lifecycle of deployed instances.

Facing the sea with spring blossoms.
Built with Hugo
Theme Stack designed by Jimmy