Ravindra BagaleCourses & study guides Track your progress

Guides

How to Install Helm and Deploy Your First Chart: Helm 3 Step by Step

Helm is the package manager for Kubernetes. Install Helm 3 (for example brew install helm or the official get-helm-3 script), add a chart repository with helm repo add, and install a chart with helm install RELEASE REPO/CHART -f values.yaml. Every helm upgrade creates a new revision, so helm rollback can undo a bad change in seconds. Helm 3 uses your kubeconfig and RBAC directly; the old Tiller server is gone.

Quick answer

curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
helm repo add bitnami https://charts.bitnami.com/bitnami && helm repo update
helm install web bitnami/nginx -n web --create-namespace
helm list -n web

A live example first

We want nginx in namespace web with 2 replicas and a ClusterIP Service.

  1. Install Helm and check it:
helm version
version.BuildInfo{Version:"v3.16.x", GitCommit:"...", GoVersion:"go1.22"}
  1. Add the repo and look at the chart's settings:
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
helm show values bitnami/nginx | less
  1. Write values.yaml:
replicaCount: 2
service:
  type: ClusterIP
resources:
  requests: { cpu: 100m, memory: 128Mi }
  limits:   { memory: 256Mi }
  1. Install:
helm install web bitnami/nginx -n web --create-namespace -f values.yaml
kubectl get pods -n web
NAME                        READY   STATUS
web-nginx-6b7d9c7d9-4kz2m   1/1     Running
web-nginx-6b7d9c7d9-p8l5n   1/1     Running
  1. Upgrade to 3 replicas, then pretend it broke and roll back:
helm upgrade web bitnami/nginx -n web -f values.yaml --set replicaCount=3
helm history web -n web
helm rollback web 1 -n web
REVISION  STATUS      DESCRIPTION
1         superseded  Install complete
2         superseded  Upgrade complete
3         deployed    Rollback to 1

Friends, that rollback took about two seconds.

How does Helm work?

Helm install flow Helm combines a chart with your values, renders Kubernetes YAML, applies it as a release, and keeps revisions for rollback. Helm install flow Charttemplatesvalues.yamlyour settingsRenderYAMLReleaserev 1, 2Rollbackone command you Chart + values = release. Every upgrade is a revision you can roll back

A chart plus your values becomes a release, and each upgrade is a revision you can roll back.

A chart is a folder of YAML templates with placeholders like {{ .Values.replicaCount }}. Helm fills them with the chart's default values plus your overrides, sends the resulting YAML to the Kubernetes API, and stores a record of that revision as a Secret in the namespace. On upgrade, it compares and applies the changes.

How do I install Helm on each system?

System Command
Linux (any) curl -​fsSL https://​raw.​githubusercontent.​com/​helm/​helm/​main/​scripts/​get-​helm-​3 \| bash
macOS brew install helm
Windows choco install kubernetes-​helm or winget install Helm.​Helm
Ubuntu/Debian the Helm apt repository from the official install docs
CI (GitHub Actions) azure/setup-helm action

Read the script before you pipe it to bash, or download the release binary and check its checksum.

How do I deploy a chart step by step?

  1. Check kubectl config current-context points to the right cluster.
  2. helm repo add NAME URL and helm repo update.
  3. helm show values REPO/CHART to see the settings.
  4. Write your own small values.yaml with only the changes.
  5. Preview: helm install web REPO/CHART -f values.yaml --dry-run --debug.
  6. Install with -n NAMESPACE --create-namespace.
  7. Upgrade with helm upgrade --install (works the first time too).
  8. Roll back with helm rollback if needed.

Make your own chart

helm create myapp
tree myapp
myapp/
  Chart.yaml        # name, version, appVersion
  values.yaml       # default settings
  templates/
    deployment.yaml
    service.yaml
    _helpers.tpl

Change image.repository and image.tag in values.yaml to your app (Node.js, Java, Python or Go image, it does not matter), then:

helm lint myapp
helm template myapp ./myapp | less
helm upgrade --install myapp ./myapp -n apps --create-namespace

Charts can also be stored in OCI registries such as Amazon ECR: helm push myapp-0.1.0.tgz oci://123456789012.dkr.ecr.ap-south-1.amazonaws.com/charts.

Common errors

Error Cause Fix
Kubernetes cluster unreachable kubeconfig wrong or missing Fix kubectl access first
cannot re-​use a name that is still in use Release exists Use helm upgrade --​install
another operation is in progress Earlier install interrupted helm history, then helm rollback to the last good revision
forbidden RBAC limits Ask for rights in that namespace
Pods fail after install Wrong values kubectl describe pod, fix values, upgrade

Security tips

  1. Use charts from trusted publishers and pin chart versions (--version 18.2.0).
  2. Review rendered YAML with helm template before production.
  3. Do not put passwords in values.yaml in Git. Use External Secrets, Sealed Secrets or AWS Secrets Manager.
  4. Scan images used by charts with a tool like Trivy.

Real example: why Tiller was removed

In Helm 2, a server component called Tiller ran inside the cluster, often with cluster-admin rights. Anyone who could reach it inside the cluster could ask it to install anything. Security researchers and the Kubernetes community warned about this for years, and Helm 3 (November 2019) removed Tiller completely, so Helm now uses each user's own permissions. If you find old blog posts telling you to run helm init, they are about Helm 2.

Mistakes to avoid

  1. Copying the whole default values file. Keep only your changes.
  2. Using latest image tags. Rollbacks become unreliable.
  3. Editing Helm-managed objects with kubectl. The next upgrade overwrites your change.

Summary table

Task Command
Install Helm script, brew, choco/winget
Add repo helm repo add NAME URL
Install helm install REL REPO/​CHART -​f values.​yaml
Preview helm template / --dry-run
Upgrade helm upgrade --​install
Roll back helm rollback REL REV
Remove helm uninstall REL

Quick quiz: check what you learned

  1. What is a Helm release?

    1. One installed copy of a chart
    2. A Docker image build step
    3. A Kubernetes node pool
    4. A Git branch for charts
    Show answer

    A. Installing a chart creates a named release.

  2. Which Helm 2 part was removed in Helm 3?

    1. Tiller
    2. Charts
    3. Values
    4. Repositories
    Show answer

    A. Helm 3 removed the in-cluster Tiller server.

  3. Which command undoes a bad upgrade?

    1. helm rollback
    2. helm repo update
    3. helm template
    4. helm lint
    Show answer

    A. helm rollback returns to an earlier revision.

  4. How do you preview rendered YAML without installing?

    1. helm template
    2. helm uninstall
    3. helm repo add
    4. helm status
    Show answer

    A. helm template prints the YAML locally.

Frequently asked questions

What is Helm?

Helm is a package manager for Kubernetes. A chart is a package of Kubernetes YAML templates, and a release is one installed copy of a chart.

Is Tiller needed?

No. Tiller was removed in Helm 3 (released in November 2019). Helm 3 talks to the cluster directly with your kubeconfig and RBAC.

Where does Helm store release history?

As Kubernetes Secrets in the release namespace, one per revision.

How do I see what Helm will create?

Use helm template or helm install --dry-run --debug to print the rendered YAML.

How do I change settings?

Put overrides in a values.yaml file and pass it with -f, or use --set key=value for small changes.

How do I undo a bad upgrade?

Run helm history RELEASE to see revisions, then helm rollback RELEASE REVISION.