Skip to main content

Chapter 10.1 - Introduction to Helm

Learning Objectives​

By the end of this chapter, you will be able to:

  • Understand what Helm is and why to use it
  • Install Helm
  • Understand the basic concepts (Charts, Releases, Repositories)
  • Install and manage Charts
  • Understand the advantages of Helm
  • Use basic Helm commands

Introduction​

Helm is the package manager for Kubernetes. It simplifies the installation and management of complex applications in Kubernetes.


What is Helm?​

Helm is a tool that allows you to:

  • Define Kubernetes applications as reusable packages
  • Install complex applications with a single command
  • Update and manage application versions
  • Share applications via repositories

Analogy: Helm is like apt for Ubuntu or npm for Node.js, but for Kubernetes.


Key Concepts​

Chart​

A Chart is a Kubernetes application package. It contains:

  • YAML templates for Kubernetes resources
  • Default values file (values.yaml)
  • Metadata (Chart.yaml)

Release​

A Release is an instance of a Chart deployed in a cluster. The same Chart can be installed multiple times with different releases.

Repository​

A Repository is a collection of Charts. It can be local or remote (HTTP).


Installation​

Linux/Mac​

# Download Helm
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash

# Verify
helm version

Windows​

# Via Chocolatey
choco install kubernetes-helm

# Or download from GitHub
# https://github.com/helm/helm/releases

Verification​

helm version
# version.BuildInfo{Version:"v3.12.0", ...}

Basic Commands​

Adding a Repository​

# Bitnami repository (popular)
helm repo add bitnami https://charts.bitnami.com/bitnami

# Update repositories
helm repo update

# List repositories
helm repo list

Searching for Charts​

# Search in repositories
helm search repo nginx

# Search in Artifact Hub
helm search hub nginx

Installing a Chart​

# Basic installation
helm install my-release bitnami/nginx

# With a custom release name
helm install web-server bitnami/nginx

# With custom values
helm install my-release bitnami/nginx -f my-values.yaml

# With inline values
helm install my-release bitnami/nginx \
--set service.type=LoadBalancer \
--set replicaCount=3

Listing Releases​

# View all releases
helm list

# View in a specific namespace
helm list -n production

# View all releases (including deleted)
helm list --all

Updating a Release​

# Update with new values
helm upgrade my-release bitnami/nginx -f new-values.yaml

# Update to a new version
helm upgrade my-release bitnami/nginx --version 15.0.0

# Rollback
helm rollback my-release 1

Deleting a Release​

# Delete a release
helm uninstall my-release

# View history before deletion
helm history my-release

Example: Installing NGINX​

Step 1: Add the Repository​

helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update

Step 2: Search for the Chart​

helm search repo nginx

Step 3: Install​

helm install my-nginx bitnami/nginx

Step 4: Verify​

# View the release
helm list

# View created resources
kubectl get all -l app.kubernetes.io/instance=my-nginx

# Get the URL
helm status my-nginx

Advantages of Helm​

1. Simplicity​

Without Helm:

kubectl apply -f deployment.yaml
kubectl apply -f service.yaml
kubectl apply -f configmap.yaml
kubectl apply -f ingress.yaml
# ... 10+ files

With Helm:

helm install my-app ./my-chart

2. Version Management​

# Install a specific version
helm install my-app ./my-chart --version 1.2.3

# Update
helm upgrade my-app ./my-chart --version 1.3.0

# Rollback
helm rollback my-app 1

3. Reusability​

A Chart can be used for multiple environments:

helm install my-app-dev ./my-chart -f dev-values.yaml
helm install my-app-prod ./my-chart -f prod-values.yaml

4. Sharing​

Charts can be shared via public or private repositories.


Chart Structure​

my-chart/
├── Chart.yaml # Metadata
├── values.yaml # Default values
├── templates/ # Kubernetes templates
│ ├── deployment.yaml
│ ├── service.yaml
│ └── configmap.yaml
└── charts/ # Dependencies

Useful Commands​

Information​

# View a Chart's values
helm show values bitnami/nginx

# View a release's values
helm get values my-release

# View the generated manifest
helm get manifest my-release

# View notes
helm get notes my-release

Debugging​

# Template with dry-run
helm install my-release ./my-chart --dry-run --debug

# View computed values
helm install my-release ./my-chart --debug --dry-run

Best Practices​

1. Use Repositories​

Prefer official repositories over local Charts when possible.

2. Versioning​

Use specific versions in production.

3. Values Files​

Separate values by environment (dev, staging, prod).

4. Testing​

Test Charts with --dry-run before installation.

5. Documentation​

Document customizable values in values.yaml.


Summary​

In this chapter, you learned:

Helm: Package manager for Kubernetes
Chart: Kubernetes application package
Release: Instance of a deployed Chart
Repository: Collection of Charts
Installation: helm install with repositories
Management: helm upgrade, helm rollback, helm uninstall
Advantages: Simplicity, versioning, reusability, sharing
Best practices: Repositories, versioning, values files, testing


Next Steps​

Chapter 10.2: Helm Charts (Creation and Structure)
Chapter 10.3: Templates and Values
Lab 10.1: Installing and Using Helm Charts


Chapter created on: December 2024