Helm Package Management

Introduction

Early in my Kubernetes journey, I maintained hundreds of YAML files for deploying applications across multiple environments. Every configuration change required editing multiple files, and keeping development, staging, and production in sync was a nightmare. Then I discovered Helm, and it completely transformed how I managed Kubernetes applications.

Over the years, I've built custom Helm charts for complex microservices architectures, contributed to open-source charts, and designed chart repositories for enterprise organizations. I've debugged chart template issues, optimized upgrade strategies, and learned the hard way about the importance of proper versioning and rollback procedures.

In this comprehensive guide, I'll share everything I've learned about Helm—from basic concepts to advanced templating techniques and production-ready deployment patterns.

Table of Contents

Understanding Helm

Helm is the package manager for Kubernetes, often called "the apt/yum/homebrew for Kubernetes." It solves the problem of managing complex Kubernetes applications by packaging multiple resources into reusable, versioned units called charts.

The Problem Helm Solves

Without Helm, deploying a typical application requires managing numerous YAML files for deployments, services, ConfigMaps, secrets, ingresses, and more. Each environment needs different configurations, leading to file duplication or complex templating scripts. Helm provides a standardized solution for packaging, versioning, and distributing Kubernetes applications.

spinner

Traditional Approach Problems

  • Duplication: Separate files for dev, staging, prod

  • Inconsistency: Manual edits lead to drift between environments

  • Versioning: No standard way to version application releases

  • Rollback: Manual process to revert changes

  • Dependency Management: No tracking of component versions

How Helm Helps

  • Packaging: Bundle all Kubernetes resources into a single chart

  • Templating: Single template with environment-specific values

  • Versioning: Semantic versioning for releases

  • Rollback: Built-in rollback to previous versions

  • Dependency Management: Charts can depend on other charts

  • Distribution: Share charts via repositories

Helm Architecture and Components

Helm 3 architecture is simpler than Helm 2 (which had Tiller):

spinner

Key Components

1. Helm CLI: Command-line tool for managing charts and releases

2. Chart: Package containing all resource definitions and templates

3. Repository: Collection of charts (like npm registry or Docker Hub)

4. Release: Instance of a chart running in a cluster

5. Values: Configuration that customizes a chart

Installing and Configuring Helm

Installation

Basic Configuration

Working with Helm Charts

Installing a Chart

Listing Releases

Viewing Release Info

Upgrading Releases

Rolling Back

Uninstalling

Creating Custom Charts

Chart Structure

Chart.yaml

values.yaml

Helm Templating

Template Syntax

Helm uses Go templates with additional functions:

Template Functions

_helpers.tpl

Managing Releases

Release Lifecycle

Atomic Deployments

Testing Releases

Values and Configuration

Environment-Specific Values

Installing per environment:

Values Priority

Values are merged in this order (highest priority last):

  1. Chart's values.yaml

  2. Parent chart's values.yaml (if subchart)

  3. Values file specified with -f (can be multiple)

  4. Individual values set with --set

Complex Values with --set

Chart Repositories

Creating a Repository

Using GitHub Pages

OCI Registry Support

Helm 3.8+ supports OCI registries:

Helm Hooks and Lifecycle

Available Hooks

  • pre-install: Before any resources are created

  • post-install: After all resources are created

  • pre-delete: Before any resources are deleted

  • post-delete: After all resources are deleted

  • pre-upgrade: Before upgrade

  • post-upgrade: After upgrade

  • pre-rollback: Before rollback

  • post-rollback: After rollback

  • test: When helm test is run

Hook Example

Hook Deletion Policies

  • before-hook-creation: Delete previous hook before new one

  • hook-succeeded: Delete after successful execution

  • hook-failed: Delete if hook fails

Advanced Patterns

Subcharts

Library Charts

Named Templates for Reuse

Troubleshooting Helm Issues

Common Issues

1. Release not found:

2. Values not applying:

3. Template errors:

4. Upgrade failures:

5. Hook failures:

Best Practices

1. Version Everything

2. Document Charts

3. Use Linting

4. Test Charts

5. Security

What I Learned

Key lessons from years of working with Helm:

1. Start Simple: Don't over-engineer charts initially. Start with basic templates and add complexity as needed.

2. Values Schema: Well-designed values.yaml is crucial. Think carefully about structure and defaults.

3. Version Strategy: Maintain separate chart versions from app versions. Chart version tracks template changes.

4. Testing Matters: Always test charts in non-production first. Use --dry-run and helm template extensively.

5. Documentation: Good documentation is essential. Future you (and your team) will thank you.

6. Upgrade Strategy: Use --atomic for production upgrades. Automatic rollback saves you from many disasters.

7. Dependencies: Pin dependency versions. Floating versions cause unexpected breaks.

8. Secrets Management: Never store secrets in charts or values files. Use external secret management.

9. Lint Always: Make helm lint part of CI pipeline. Catch errors before deployment.

10. Keep Charts Simple: Resist the urge to make charts too configurable. Sometimes separate charts are better than one complex chart.

Helm transformed how I deploy to Kubernetes. It eliminated hundreds of duplicate YAML files, made environment management trivial, and enabled proper versioning and rollback. The investment in learning Helm pays back quickly in reduced deployment complexity and increased reliability.

Last updated