Packaging Kubernetes apps with Helm and Kustomize
Three environments, one app, 90 percent identical YAML. Helm templates it with values, Kustomize patches plain YAML with overlays. When to reach for each.
Kubernetes core objectsBuild once, promote through environments
Packaging Kubernetes apps with Helm and Kustomize
The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.
Not started
What you'll learn
- Copying manifests per environment drifts over time. Both Helm and Kustomize keep one source and generate the per-environment differences.
- Helm is templating plus packaging: a chart holds Go-templated manifests and a values file, and each install is a versioned release you can upgrade or roll back.
- Kustomize is patching: a base of plain, valid YAML plus overlays that change only what differs. It is built into kubectl as kubectl apply -k.
- Helm suits software you install from someone else, because the chart author decides what is configurable. Kustomize suits your own apps, because you can patch anything.
- Always render before you apply, with helm template or kubectl kustomize, so you review the YAML that will actually reach the cluster.
Three copies that slowly stop matching
The notes API from the core objects lesson now runs in dev, staging and production. Dev wants one replica and debug logging. Production wants five replicas, more memory and a pinned image digest. Everything else is the same.
The first instinct is three folders of YAML. It works for a month. Then someone adds a readiness probe to production only, and staging stops being a faithful rehearsal, which defeats the point of promoting through environments. You want one source of truth and a small, reviewable description of each environment’s differences. There are two standard ways to get that.
Helm: templates plus values
Helm treats an app as a package, called a chart. A chart is a directory of templated manifests plus a values.yaml of defaults. You install it with your own values, and Helm renders the templates into plain YAML and applies them. Each install is a release with a revision history, so helm rollback returns to an earlier one.
I downloaded a real chart, podinfo, a small demo app by Stefan Prodan that is widely used in Kubernetes tutorials. Its repository index listed 111 versions. The newest, 6.17.0, unpacks to (some files omitted):
podinfo/Chart.yaml
podinfo/values.yaml
podinfo/values-prod.yaml
podinfo/templates/_helpers.tpl
podinfo/templates/deployment.yaml
podinfo/templates/service.yaml
podinfo/templates/hpa.yaml
podinfo/templates/ingress.yaml
podinfo/templates/httproute.yaml
podinfo/templates/tests/service.yaml
Chart.yaml holds the chart’s own version and the app version (6.17.0 for both) and kubeVersion: '>=1.23.0-0'. values.yaml sets defaults such as replicaCount: 1, image.repository: ghcr.io/stefanprodan/podinfo and service.httpPort: 9898. The template is where it gets interesting:
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "podinfo.fullname" . }}
...
spec:
{{- if not .Values.hpa.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
That is a Go template, not YAML. When I tried to load the file with Python’s YAML parser it failed with ParserError: while parsing a flow node. 176 of the file’s 262 lines contain {{. That is Helm’s strength and its cost. The chart author can make anything conditional, and you can only change what they chose to expose in values.yaml.
The workflow, from Helm’s docs. I did not run it, since there is no Helm or cluster here:
helm install notes ./chart -f values-prod.yaml --namespace prod
helm template notes ./chart -f values-prod.yaml # render without installing
helm upgrade notes ./chart -f values-prod.yaml
helm rollback notes 3
The current release when I checked was Helm v4.3.2. Helm 4 came out in late 2025, and the video below says Helm 3 security fixes stop on 10 February 2027, so older tutorials written for Helm 3 mostly still apply but are worth checking against the Helm 4 changes.
Kustomize: a base plus patches
Kustomize takes the opposite approach. There are no templates. The base is ordinary, valid Kubernetes YAML. An overlay points at the base and lists changes. Kustomize merges them and prints the result. It is built into kubectl, so kubectl apply -k overlays/prod works with nothing extra installed.
The same podinfo repository ships a Kustomize base next to its chart. Its kustomization.yaml, fetched from GitHub, is just a list of plain files:
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- hpa.yaml
- deployment.yaml
- service.yaml
A production overlay for it, written from the Kustomize documentation and not run:
# overlays/prod/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: prod
resources:
- https://github.com/stefanprodan/podinfo//kustomize?ref=6.17.0
images:
- name: ghcr.io/stefanprodan/podinfo
digest: sha256:fa2f27c1a8561097e5144bfc0853eba6054d743b68b03de4cad4675616ddefb0
patches:
- target:
kind: Deployment
name: podinfo
patch: |-
- op: replace
path: /spec/template/spec/containers/0/resources/limits/memory
value: 1Gi
The base sets a 512Mi memory limit, and this overlay raises it to 1Gi. The images entry pins the image to the digest the 6.17.0 tag pointed at when I asked GitHub’s registry, so a moved tag cannot change production. The overlay states only what is different, so a reviewer reads a dozen lines, not two hundred. kubectl kustomize overlays/prod prints the merged YAML so you can review it before applying. The latest standalone release when I checked was kustomize v5.8.3.
Think of the difference as a form versus tracing paper. Helm hands you a form with blanks the author chose. Kustomize lets you lay tracing paper over the original and redraw any line.
Which one, and when
- Installing someone else’s software, such as a database operator, cert-manager or a monitoring stack: use their Helm chart. The author knows which settings are safe to expose.
- Your own services: Kustomize keeps the manifests readable as plain YAML and makes environment differences obvious in review.
- Both: plenty of teams install third-party charts with Helm and manage their own apps with Kustomize. Kustomize can also render a Helm chart and patch its output, for the setting a chart forgot to expose.
Either way, render before you apply. The YAML that reaches the cluster is what matters, and in GitOps a controller will do the rendering and applying for you.
About the video
“Kustomize vs Helm Explained (And Why You Need Both)” is from DevOps with Flavius, published October 2026, 8 minutes 19 seconds. Its chapters cover the three-environment problem, Helm’s templating and packaging, Kustomize’s bases and overlays, Kustomize being built into kubectl, generators and components, “who decides what you can change”, when each wins, using both, Kustomize on top of Helm, and Helm 3’s end of life and Helm 4 changes. That is very close to this lesson. It is a small channel. English was judged from the title, description, channel and its English caption tracks. Nodematic’s video in deeper is a hands-on Kustomize demo with a base and two overlays.
Where this fits
That closes the containers group. The next group applies the same declare-and-reconcile idea to the servers, networks and clusters themselves, starting with infrastructure as code: declarative vs imperative.
Check yourself
What does Helm give you that copying YAML files does not?
One parameterised chart rendered with a different values file per environment, packaged with a version, and installed as a release whose history allows upgrade and rollback.
Why can't you run a Helm template file through a YAML parser or kubectl directly?
It is a Go template, not YAML. The {{ }} expressions must be rendered with values first, by helm template or helm install.
In Kustomize, what is the difference between a base and an overlay?
The base is the full set of plain manifests shared by every environment. An overlay points at the base and lists only the changes for one environment, such as replica count, image tag or namespace.
You need a setting the third-party chart's values.yaml does not expose. What are your options?
Fork the chart, ask upstream to expose it, or render the chart and patch the output with Kustomize, which can patch any field.
Go deeper
Notes
Notes are saved to your account.
Everything else on this page works without one — progress and bookmarks keep themselves in this browser and come with you when you sign in. Notes are the one thing worth not trusting to a browser you might clear.
Your notes could not be loaded.