Packaging with Helm and Kustomize

Template, version and reuse Kubernetes manifests across environments with Helm charts or Kustomize overlays.

Intermediate · about 6 hours · difficulty 3/5

Learn first: Services, Ingress and Network Policy, Configuration, Secrets, Storage and RBAC

Copy-pasting YAML for dev, staging and production does not scale. Two tools dominate manifest management, and most teams use both.

Helm

  • A chart is a package of templated manifests plus values.yaml defaults. helm install, upgrade --install, rollback, uninstall, and releases tracked in the cluster.
  • Templates use Go templating ({{ .Values.image.tag }}), helpers in _helpers.tpl, and conditionals.
  • Charts are distributed via repositories or OCI registries; you will install most third-party software (ingress-nginx, Prometheus, cert-manager) with Helm.
  • helm template and helm lint render and check charts locally; helm diff (plugin) previews changes.

Kustomize

  • Built into kubectl apply -k. No templating: a base of plain YAML plus overlays that patch it per environment.
  • Great for your own apps when you only need small per-environment differences.

Choosing

Helm shines for distributing configurable software; Kustomize shines for simple overlays of your own manifests. GitOps tools support both.

Pitfalls

Charts with hundreds of values nobody understands, secrets in values.yaml committed to git, and helm upgrade without checking the rendered diff.

Good enough to move on: you can write a chart for your app with per-environment values files, and install a third-party chart with pinned version and custom values.

Key concepts

  • Charts, values and releases
  • Go templating in charts
  • helm upgrade and rollback
  • OCI chart registries
  • helm template, lint and diff
  • Kustomize bases and overlays

Mini project

Package your app as a Helm chart with values-dev.yaml and values-prod.yaml (different replicas, resources and hostnames), push it to an OCI registry, and install both environments into separate namespaces.

Check yourself

When would Kustomize be a better fit than writing a Helm chart for your own service?

Free resources