Helm vs Kustomize
You've now packaged linkly both ways. Neither tool is "better"; they optimise for different readers. A chart optimises for people who install software they didn't write: they read a values file and never open the templates. A kustomization optimises for people who own the manifests: everything is plain YAML they can read and diff.
The same change, both ways
Production needs four replicas and image 1.4.1. In Helm you change values; in Kustomize, an overlay. Both produce the same Deployment fields:
mkdir -p chart/templates kust/base kust/prod
printf 'apiVersion: v2\nname: linkly\nversion: 1.0.0\nappVersion: "1.4.0"\n' > chart/Chart.yaml
printf 'replicaCount: 2\nimage:\n repository: ghcr.io/acme/linkly\n tag: ""\n' > chart/values.yaml
cat > chart/templates/deployment.yaml <<'EOF'
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}
spec:
replicas: {{ .Values.replicaCount }}
selector: {matchLabels: {app: linkly}}
template:
metadata: {labels: {app: linkly}}
spec:
containers:
- name: linkly
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
EOF
printf 'replicaCount: 4\nimage:\n tag: "1.4.1"\n' > values-prod.yaml
cat > kust/base/deployment.yaml <<'EOF'
apiVersion: apps/v1
kind: Deployment
metadata:
name: linkly
spec:
replicas: 2
selector: {matchLabels: {app: linkly}}
template:
metadata: {labels: {app: linkly}}
spec:
containers:
- name: linkly
image: ghcr.io/acme/linkly:1.4.0
EOF
printf 'resources: [deployment.yaml]\n' > kust/base/kustomization.yaml
cat > kust/prod/kustomization.yaml <<'EOF'
resources: [../base]
replicas: [{name: linkly, count: 4}]
images: [{name: ghcr.io/acme/linkly, newTag: "1.4.1"}]
EOF
show() { yq -o json -I0 '{"replicas": .spec.replicas, "image": .spec.template.spec.containers[0].image}'; }
echo "helm: $(helm template linkly chart -f values-prod.yaml | show)"
echo "kustomize: $(kustomize build kust/prod | show)"
echo "lines of packaging: helm $(cat chart/templates/*.yaml chart/values.yaml values-prod.yaml | wc -l), kustomize $(cat kust/*/*.yaml | wc -l)"helm: {"replicas":4,"image":"ghcr.io/acme/linkly:1.4.1"}
kustomize: {"replicas":4,"image":"ghcr.io/acme/linkly:1.4.1"}
lines of packaging: helm 20, kustomize 17
Same result. The difference is in who can change what: the chart exposes only replicaCount and image.*, and any other change needs a new chart version; the overlay can patch any field of any object, today, without asking anyone.
Side by side
| Helm | Kustomize | |
|---|---|---|
| Source files | templates (not valid YAML until rendered) | valid Kubernetes YAML |
| Customisation | only what the chart author exposed in values | any field, by patching |
| Logic | conditionals, loops, functions | none (by design) |
| Packaging & versioning | charts with SemVer, OCI registries, dependencies | Git directories and refs |
| Install lifecycle | releases, revisions, rollback, hooks, tests | none; kubectl apply -k or a GitOps tool |
| Learning curve | Go templates, Sprig, scope, whitespace | merge semantics, build order |
| Failure mode | unreadable templates ("YAML engineering"), values explosion | sprawling patch stacks, surprising build order |
| Best at | distributing software to other people | describing your own environments |
A decision guide
- You publish software for others to install (an open-source project, a platform team's shared service): Helm. Users expect a chart, and values plus a schema form a stable interface.
- You deploy your own services to a few environments: Kustomize is usually enough, and plain YAML is easier to review. Many teams never need templates.
- You install third-party software: use its chart. If you need a change the chart doesn't expose, render it through Kustomize (next lesson) instead of forking it.
- You need logic (generate N similar objects, compute values): Helm, or a real language (cdk8s, Jsonnet/Tanka, CUE/Timoni). Don't fake loops with dozens of patches.
- You use GitOps: both work. Argo CD and Flux render Helm and Kustomize natively, and Flux has dedicated
HelmReleaseandKustomizationresources. See the planned GitOps course.
The common combination
Many organisations end up with this split, and so does this course's Mini Project:
- Each service is a chart, published to an OCI registry by CI with a SemVer version.
- Each environment is a Kustomize overlay in a deployment repository, which renders a pinned chart version with environment values and patches the few things the chart doesn't expose.
- A GitOps controller applies the overlays; promotion is a commit that bumps the chart version in an overlay.
Test yourself
A third-party chart doesn't expose a field you must change. What's usually the best option?
- Fork the chart
- Edit the objects with kubectl after install
- Render the chart through Kustomize and patch the field
- Ask users to set it by hand
Which tool keeps every source file valid Kubernetes YAML?
- Helm
- Kustomize
- Both
- Neither
What does Helm offer that Kustomize alone does not?
- Patching any field
- Release history with rollback, hooks and tests
- Plain YAML
- Being built into kubectl