Skip to main content

Helm Package Manager

Helm is the package manager for Kubernetes. It helps you define, install, and upgrade even the most complex Kubernetes application.

Why Helm?

Kubernetes YAML files can get repetitive and hard to manage. Helm solves this with Charts.

Package Management

Find, share, and use software built for Kubernetes (like apt or npm).

Templating

Use a single template for Dev, Staging, and Prod environments.

Release Management

Easy upgrades and rollbacks with revision history.

Dependency Management

Manage dependencies (e.g., your app needs Redis).

Core Concepts

  • Chart: A bundle of information necessary to create an instance of a Kubernetes application.
  • Config: The configuration information that can be merged into a packaged chart to create a releasable object.
  • Release: A running instance of a chart, combined with a specific config.
  • Repository: A place where charts can be collected and shared.

Using Helm

1. Installation

# Install Helm (Linux/macOS)
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash

# Add a Repository (Bitnami)
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update

2. Installing a Chart

Install Redis using the Bitnami chart.
# Install
helm install my-redis bitnami/redis

# List releases
helm list

# Uninstall
helm uninstall my-redis

3. Customizing Installation (values.yaml)

You can override default settings using a values.yaml file or CLI flags.
# See default values
helm show values bitnami/redis > values.yaml

# Edit values.yaml (e.g., change password or replica count)
# ...

# Install with custom values
helm install -f values.yaml my-redis bitnami/redis

# OR use --set
helm install my-redis bitnami/redis --set architecture=replication --set auth.password=secret123

Creating Your Own Chart

# Create chart structure
helm create my-chart

Structure

my-chart/
  Chart.yaml          # Metadata (name, version)
  values.yaml         # Default configuration values
  charts/             # Dependencies
  templates/          # The template files (k8s YAMLs with {{ placeholders }})
    deployment.yaml
    service.yaml
    _helpers.tpl

Templating Example

values.yaml:
replicaCount: 3
image:
  repository: nginx
  tag: latest
templates/deployment.yaml:
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ .Release.Name }}-nginx
spec:
  replicas: {{ .Values.replicaCount }}
  template:
    spec:
      containers:
        - name: nginx
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"

Managing Releases

# Upgrade a release (change config or image)
helm upgrade my-redis bitnami/redis --set auth.password=newsecret

# View revision history
helm history my-redis

# Rollback to previous version
helm rollback my-redis 1

Key Takeaways

  • Use Helm to manage complex apps.
  • Use Repositories (Artifact Hub) to find existing software.
  • Use values.yaml to configure charts for different environments.
  • Use helm upgrade and helm rollback for safe deployments.

Next: Kubernetes Architecture →