Helm — Kubernetes Package Manager

25 minLesson 5 of 8

Learning Objectives

  • Understand Helm concepts (charts, releases, repositories)
  • Install and use Helm CLI
  • Deploy applications with Helm charts
  • Create custom Helm charts

What is Helm?

Helm is the package manager for Kubernetes. It simplifies deploying complex applications by packaging manifests into reusable charts.

Why Helm?

Without HelmWith Helm
Dozens of YAML filesSingle helm install command
Manual variable substitutionTemplated values
No versioningRelease history and rollback
Hard to shareReusable chart repositories

Helm Concepts

ConceptDescription
ChartPackage of Kubernetes manifests
ReleaseAn installed instance of a chart
RepositoryCollection of charts
ValuesConfiguration for a chart

Installing Helm

# macOS
brew install helm
 
# Linux
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
 
# Verify
helm version

Using Helm Charts

Adding Repositories

# Add official repos
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
 
# Search for charts
helm search repo nginx
helm search repo postgresql

Installing a Chart

# Install NGINX
helm install my-nginx bitnami/nginx
 
# Install with custom values
helm install my-app bitnami/nginx \
  --set replicaCount=3 \
  --set service.type=LoadBalancer
 
# Install with values file
helm install my-app bitnami/nginx -f values.yaml
 
# Install in a specific namespace
helm install my-app bitnami/nginx -n production --create-namespace

Managing Releases

# List releases
helm list
helm list -A  # All namespaces
 
# Check release status
helm status my-app
 
# Upgrade a release
helm upgrade my-app bitnami/nginx --set replicaCount=5
 
# Rollback
helm rollback my-app 1  # Rollback to revision 1
 
# Uninstall
helm uninstall my-app

Creating a Custom Chart

# Scaffold a new chart
helm create nextgen-app
 
# Generated structure:
nextgen-app/
├── Chart.yaml          # Chart metadata
├── values.yaml         # Default configuration
├── charts/             # Dependencies
├── templates/          # Kubernetes manifests
   ├── deployment.yaml
   ├── service.yaml
   ├── ingress.yaml
   ├── hpa.yaml
   ├── _helpers.tpl    # Template helpers
   └── NOTES.txt       # Post-install notes
└── .helmignore

Chart.yaml

apiVersion: v2
name: nextgen-app
description: NextGen Playground Academy application
type: application
version: 0.1.0
appVersion: "1.0.0"

values.yaml

replicaCount: 3
 
image:
  repository: nextgen-app
  tag: "1.0.0"
  pullPolicy: IfNotPresent
 
service:
  type: ClusterIP
  port: 80
 
ingress:
  enabled: true
  host: learn.nextgenplayground.org
 
resources:
  requests:
    memory: "128Mi"
    cpu: "100m"
  limits:
    memory: "256Mi"
    cpu: "200m"

templates/deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "nextgen-app.fullname" . }}
  labels:
    {{- include "nextgen-app.labels" . | nindent 4 }}
spec:
  replicas: {{ .Values.replicaCount }}
  selector:
    matchLabels:
      {{- include "nextgen-app.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      labels:
        {{- include "nextgen-app.selectorLabels" . | nindent 8 }}
    spec:
      containers:
      - name: {{ .Chart.Name }}
        image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
        ports:
        - containerPort: 3000
        resources:
          {{- toYaml .Values.resources | nindent 12 }}

Installing Your Chart

# Install from local directory
helm install my-release ./nextgen-app
 
# With custom values
helm install my-release ./nextgen-app -f production-values.yaml
 
# Dry run (preview without installing)
helm install my-release ./nextgen-app --dry-run --debug
 
# Template rendering (see generated YAML)
helm template my-release ./nextgen-app

Summary

You've learned:

  • Helm concepts: charts, releases, repositories, values
  • Installing and managing applications with Helm
  • Creating custom charts with templates
  • Upgrading, rolling back, and managing releases

Next Steps

You now have a solid Kubernetes foundation. Continue to the Monitoring module to learn how to observe your clusters and applications in production.