Featured image of post Helm in a Nutshell

Helm in a Nutshell

Nutshell Guide with Command and Config Samples


1. What is Helm?

Helm is a package manager for Kubernetes that helps deploy applications as charts.

If you’ve worked with Kubernetes, you know that deploying applications can get complicated quickly.

Why Use Helm?

  • 📦 Simplifies complex deployments
  • 🔄 Manages upgrades & rollbacks easily
  • 📜 Encapsulates Kubernetes YAML files into reusable charts
  • 🚀 Enables application versioning
  • 💾 Supports dependency management

Helm abstracts away Kubernetes YAML complexity, making deployments declarative and modular.


2. Helm vs. Other Deployment Methods

Deployment MethodProsCons
kubectl applySimple, direct controlHard to manage updates
KustomizePatch-based, built-inNo dependency management
HelmReusable, versioned, templatedLearning curve

Helm is ideal when you need reusability, upgrades, and rollback features.


3. Installing Helm

Step 1: Install Helm CLI

For Linux/macOS:

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

For Windows (via Chocolatey):

1
choco install kubernetes-helm

Verify installation:

1
helm version

4. Deploying Applications with Helm

Step 1: Add a Helm Repository

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

Step 2: Install an Application (e.g., Nginx)

1
helm install my-nginx bitnami/nginx

Step 3: Verify Installation

1
kubectl get pods

To uninstall:

1
helm uninstall my-nginx

5. Creating a Helm Chart

Helm charts are pre-packaged Kubernetes applications.

Step 1: Create a Chart Structure

1
2
helm create mychart
cd mychart

This generates:

1
2
3
4
5
6
7
mychart/
│   Chart.yaml
│   values.yaml
│   templates/
│   ├── deployment.yaml
│   ├── service.yaml
│   ├── ingress.yaml

Step 2: Define the Chart.yaml

1
2
3
4
5
6
apiVersion: v2
name: mychart
description: A Helm chart for Kubernetes
type: application
version: 1.0.0
appVersion: 1.16.0

Step 3: Modify values.yaml

1
2
3
4
5
6
7
8
9
replicaCount: 2

image:
  repository: nginx
  tag: latest

service:
  type: ClusterIP
  port: 80

Step 4: Deploy Your Custom Chart

1
helm install myrelease ./mychart

To upgrade:

1
helm upgrade myrelease ./mychart

6. Helm Advanced Features

6.1 Managing Dependencies

Define dependencies in Chart.yaml:

1
2
3
4
dependencies:
  - name: postgresql
    version: "12.1.0"
    repository: "https://charts.bitnami.com/bitnami"

Then update dependencies:

1
helm dependency update

6.2 Using Helm Hooks

Define lifecycle hooks:

1
2
annotations:
  "helm.sh/hook": post-install

This runs the script after installation.

6.3 Rollbacks and Versioning

To list all releases:

1
helm list

To rollback:

1
helm rollback myrelease 1

7. Helm in Production: Best Practices

✅ Use values.yaml to configure deployments instead of modifying templates directly
✅ Enable Helm’s built-in rollback features for safe deployments
✅ Use Helmfile for managing multiple Helm releases
✅ Regularly update Helm charts and repositories
✅ Store Helm values in Git for version control


Key Takeaways

✅ Helm simplifies Kubernetes application deployment
✅ Helm Charts package YAML files into reusable templates
✅ Helm supports upgrades, rollbacks, and dependencies
✅ Best practices help keep deployments secure and manageable