DevOps.Academy
CoursesCurriculumInterview prepPricing
◔My learningSign in
DevOps.Academy

Free, hands-on DevOps lessons. Made with care in India.

System status

Learn

All coursesLinux roadmapCurriculumInterview questionsCheat sheetsMy learning

Academy

PricingCertificates

Legal

PrivacyTermsContact

devops.rajeev.pro

Kubernetes & HelmLesson 13 of 16
Your progress · 0%
On this page
  1. Charts
  2. Values
  3. Releases, upgrades and rollbacks
  4. Chart repositories
↖ Course roadmap
Lesson 13 · Helm

Helm: packaging Kubernetes apps

Stop copying YAML between environments. Package shop-web as a Helm chart, change it with values, upgrade it, watch a bad upgrade fail, roll back, and install a public chart from a repository.

30 min read · intermediate · hands-on

By the end of this lesson you'll be able to

0 of 4 complete
Lab status

Verified lab: helm create, lint and template, then install, upgrade, a failed upgrade and a rollback of the shop chart, and a public chart installed from an OCI registry, on the course's EKS cluster with Helm 4.3.1. The output shown is real.
Code walkthrough: publishing your own chart to a registry.
Cloud lab: none needed; works on kind.

By now shop-web is a Deployment, a Service, a ConfigMap, an Ingress and more. For staging you want 1 replica and a test image; for production 3 replicas and the release tag. Copying the YAML and editing it by hand works until the copies drift. Helm packages the YAML once as templates and fills in the differences from values. It's also how most third-party software is installed on Kubernetes: the load balancer controller (lesson 5) and the Cluster Autoscaler (lesson 10) both came from Helm charts.

Charts

A chart is a folder of templates plus defaults. helm create makes a working starter:

$ helm create shop
Creating shop
$ find shop -type f | sort
shop/.helmignore
shop/Chart.yaml
shop/templates/NOTES.txt
shop/templates/_helpers.tpl
shop/templates/deployment.yaml
shop/templates/hpa.yaml
shop/templates/httproute.yaml
shop/templates/ingress.yaml
shop/templates/service.yaml
shop/templates/serviceaccount.yaml
shop/templates/tests/test-connection.yaml
shop/values.yaml
find shop -type f | sort
  • findsearch for files
  • -typef for files, d for directories
  • |pipe: send output to the next command
  • sortsort lines

Chart.yaml holds the chart's name and version, values.yaml the defaults, and templates/ the Kubernetes YAML with placeholders. The course chart changed only a few defaults from the starter:

# values.yaml (changed lines)
replicaCount: 2
image:
  repository: 626159997645.dkr.ecr.ap-south-1.amazonaws.com/shop-web
  tag: 'v1'
livenessProbe:
  httpGet:
    path: /healthz
    port: http
readinessProbe:
  httpGet:
    path: /healthz
    port: http

(plus containerPort: 8080 in the Deployment template). Before installing anything, check and preview:

$ helm lint shop
==> Linting shop
[INFO] Chart.yaml: icon is recommended

1 chart(s) linted, 0 chart(s) failed
$ helm template demo shop --set replicaCount=3
...
# Source: shop/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: demo-shop
  labels:
    helm.sh/chart: shop-0.1.0
    app.kubernetes.io/name: shop
    app.kubernetes.io/instance: demo
...
spec:
  replicas: 3

helm template renders the YAML locally without touching the cluster. Make it a habit: it's how you see exactly what a values change will do, and it's what CI should check.

Values

Templates read values with {{ .Values.replicaCount }}. You override the defaults per install, from most to least common:

  • a file per environment: helm install shop ./shop -f values-prod.yaml
  • a single value on the command line: --set image.tag=v2

Later sources win. Keep environment files in Git; use --set for the one value CI changes (the image tag). Never put secrets in values files committed to Git (lesson 6 covers the alternatives).

Releases, upgrades and rollbacks

An installed chart is a release, and every change makes a new numbered revision:

$ helm install shop ./helm/shop --namespace shop --create-namespace --wait --timeout 4m
NAME: shop
LAST DEPLOYED: Mon Nov  9 06:39:55 2026
NAMESPACE: shop
STATUS: deployed
REVISION: 1
$ kubectl get deployment,pods -n shop
NAME                   READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/shop   2/2     2            2           36s
NAME                        READY   STATUS    RESTARTS   AGE
pod/shop-59757954bc-gts7r   1/1     Running   0          36s
pod/shop-59757954bc-hhvjb   1/1     Running   0          36s
$ helm upgrade shop ./helm/shop -n shop --set image.tag=v2 --set replicaCount=3 --wait --timeout 4m
Release "shop" has been upgraded. Happy Helming!
REVISION: 2
kubectl get deployment,pods -n shop
  • kubectltalk to a Kubernetes cluster
  • getlist objects
  • -nin this namespace

--wait makes Helm wait until the new Pods are ready before calling the upgrade a success. Now a bad release:

$ helm upgrade shop ./helm/shop -n shop --set image.tag=v3-broken --set replicaCount=3 --wait --timeout 90s
level=WARN msg="upgrade failed" name=shop error="resource Deployment/shop/shop not ready. status: InProgress, message: Updated: 1/3\ncontext deadline exceeded"
Error: UPGRADE FAILED: resource Deployment/shop/shop not ready. status: InProgress, message: Updated: 1/3
context deadline exceeded
$ helm history shop -n shop
REVISION  UPDATED                   STATUS      CHART       APP VERSION  DESCRIPTION
1         Mon Nov  9 06:39:55 2026  superseded  shop-0.1.0  1.16.0       Install complete
2         Mon Nov  9 06:40:47 2026  deployed    shop-0.1.0  1.16.0       Upgrade complete
3         Mon Nov  9 06:41:25 2026  failed      shop-0.1.0  1.16.0       Upgrade "shop" failed: resource Deployment/shop/shop not ready. ...

Only one new Pod was created, it crashed, and the Deployment's rolling update stopped there, so the v2 Pods kept serving. Helm marked revision 3 failed. Roll back to the last good one:

$ helm rollback shop 2 -n shop --wait --timeout 4m
Rollback was a success! Happy Helming!
$ helm history shop -n shop
...
3         Mon Nov  9 06:41:25 2026  failed      shop-0.1.0  1.16.0       Upgrade "shop" failed: ...
4         Mon Nov  9 06:43:13 2026  deployed    shop-0.1.0  1.16.0       Rollback to 2
$ kubectl get pods -n shop -o custom-columns=POD:.metadata.name,IMAGE:.spec.containers[0].image,READY:.status.containerStatuses[0].ready
POD                     IMAGE                                                       READY
shop-7b46566b6b-624j9   626159997645.dkr.ecr.ap-south-1.amazonaws.com/shop-web:v2   true
shop-7b46566b6b-6zl7s   626159997645.dkr.ecr.ap-south-1.amazonaws.com/shop-web:v2   true
shop-7b46566b6b-7j4js   626159997645.dkr.ecr.ap-south-1.amazonaws.com/shop-web:v2   true
$ helm get values shop -n shop
USER-SUPPLIED VALUES:
image:
  tag: v2
replicaCount: 3
kubectl get pods -n shop -o custom-columns=POD:.metadata.name,IMAGE:.spec.containers[0].image,READY:.status.containerStatuses[0].ready
  • kubectltalk to a Kubernetes cluster
  • getlist objects
  • -nin this namespace
  • -ooutput format

The rollback became revision 4; history is never rewritten. helm get values shows what's actually deployed, the first thing to check when someone asks "what's running in production?". (APP VERSION 1.16.0 is the starter chart's default appVersion; set it in Chart.yaml to match your app.)

Helm stores each revision as a Secret in the release's namespace, and helm uninstall removes the release and everything it created.

Chart repositories

Charts are shared through repositories (an HTTP index) and, increasingly, OCI registries, the same registries that hold images. Artifact Hub is the place to search public charts.

$ helm repo add podinfo https://stefanprodan.github.io/podinfo
"podinfo" has been added to your repositories
$ helm search repo podinfo
NAME             CHART VERSION  APP VERSION  DESCRIPTION
podinfo/podinfo  6.17.0         6.17.0       Podinfo Helm chart for Kubernetes
$ helm install demo oci://ghcr.io/stefanprodan/charts/podinfo -n shop --set replicaCount=1 --wait --timeout 4m
Pulled: ghcr.io/stefanprodan/charts/podinfo:6.17.0
Digest: sha256:258d0da545724b4eea8de5d5e724cd9a75aab3de79a87ba8d82ec402745cea58
NAME: demo
STATUS: deployed
REVISION: 1
$ helm list -n shop
NAME  NAMESPACE  REVISION  STATUS    CHART           APP VERSION
demo  shop       1         deployed  podinfo-6.17.0  6.17.0
shop  shop       4         deployed  shop-0.1.0      1.16.0
$ helm uninstall demo -n shop
release "demo" uninstalled

The OCI install needs no repo add; the digest identifies exactly what was pulled. Before installing a public chart, read its values (helm show values) and run helm template, as you would review any code you're about to run in your cluster. Pin the chart version with --version so a new release doesn't arrive by surprise.

⌘
Mini mission

Ship, break and roll back with Helm

Install the shop chart, upgrade it to v2 with 3 replicas, upgrade to v3-broken with --wait and a 90 second timeout, then roll back to the last good revision. Record the history and the deployed values.

Input: The helm/shop chartOutput: ~/helm.txt
Reveal one safe solution
$ helm lint ./shop && helm template demo ./shop | grep -E "kind:|replicas:"
$ helm install shop ./shop -n shop --create-namespace --wait
$ helm upgrade shop ./shop -n shop --set image.tag=v2 --set replicaCount=3 --wait
$ helm upgrade shop ./shop -n shop --set image.tag=v3-broken --set replicaCount=3 --wait --timeout 90s
$ helm rollback shop 2 -n shop --wait
$ helm history shop -n shop > ~/helm.txt
$ helm get values shop -n shop >> ~/helm.txt
$ helm uninstall shop -n shop
helm lint ./shop && helm template demo ./shop | grep -E "kind:|replicas:"
  • &&run the next command only if this one worked
  • |pipe: send output to the next command
  • grepfind lines that match a pattern
helm history shop -n shop > ~/helm.txt
  • >write output to a file, replacing it
helm get values shop -n shop >> ~/helm.txt
  • >>append output to a file

Expect four revisions: deployed, superseded, failed and "Rollback to 2".

Try it yourself

0 of 5 steps done

Run each task in your own account or terminal, then tick it off.

Knowledge check

Quick check

Question 1 of 3

You upgrade a release with --wait and the new Pods never become ready. What does Helm do?

Go deeper

Official reading for this lesson

  • DocsHelm documentationHelm ↗
  • DocsChart template guideHelm ↗
  • DocsUse OCI-based registriesHelm ↗
  • ToolArtifact HubArtifact Hub ↗

Or get every quiz answer right and it completes itself.

Something unclear, wrong or out of date in this lesson? Tell me, and I'll fix it.

← PreviousStorage: data that outlives PodsNext lesson →Deployment patterns: rolling, blue-green, canary, GitOps