Helm and Kustomize: Packaging Manifests Without Copy-Paste

Helm vs Kustomize compared: templated charts against patch overlays, when to use each, how to combine them and GitOps habits.

Executive Summary: Once an application runs in dev, staging and production, copying manifests per environment leads to drift. Helm solves it with templates and a values file per environment, and adds versioned packages (charts) and release history. Kustomize, built into kubectl, solves it with plain YAML bases and per-environment patches, with no templating language. A practical split: use Helm to install third-party software, Kustomize or Helm for your own services, and render both into a GitOps tool so the cluster always matches Git.
Isometric Helm chart crate with a values file beside layered Kustomize base and overlay slabs joined by a vs badge

The usual path goes like this. A service starts with five YAML files. Staging needs fewer replicas and a different hostname, so someone copies the folder. Production needs resource limits and an extra annotation, so someone copies it again. Six months later, a fix applied to staging never reached production, and nobody can tell which differences are intended. Both tools exist to make the shared parts shared and the differences explicit.

Two different philosophies

Helm Kustomize
Approach Go templates filled with values Plain YAML base plus patches
Packaging Versioned charts in repositories or OCI registries Directories, referenced locally or by Git URL
Installs and tracks releases Yes: install, upgrade, rollback, history No; it only renders YAML for kubectl or a GitOps tool
Learning curve Template syntax, chart structure, release model Small; just YAML and patch rules
Hooks and lifecycle Pre/post install and upgrade hooks, tests None
Readability of the source Templates can become hard to read Bases are valid manifests you can read and apply
Best at Distributing configurable software to others Varying your own manifests across environments

Helm

I wrote about Helm charts back in the Helm 2 days, when a server-side component called Tiller ran in the cluster. Helm 3 removed Tiller: the client talks to the API server with your own credentials, so RBAC applies normally, and release state is stored as Secrets in the release’s namespace. The current release line is Helm 3.16.

A chart for your own service is small:

billing-api/
  Chart.yaml          # name, version, appVersion, dependencies
  values.yaml         # defaults
  templates/
    _helpers.tpl
    deployment.yaml
    service.yaml
    ingress.yaml
# templates/deployment.yaml (excerpt)
spec:
  replicas: {{ .Values.replicaCount }}
  template:
    spec:
      containers:
        - name: api
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
          resources:
            {{- toYaml .Values.resources | nindent 12 }}
# values-prod.yaml: only what differs from values.yaml
replicaCount: 4
resources:
  requests: { cpu: 500m, memory: 512Mi }
  limits:   { memory: 1Gi }
ingress:
  host: billing.acme.com
helm upgrade --install billing ./billing-api \
  -n billing -f values-prod.yaml --set image.tag=2.1.0 \
  --atomic --timeout 5m

helm history billing -n billing
helm rollback billing 7 -n billing

--atomic rolls back automatically if the upgrade does not become healthy within the timeout. helm template renders the YAML locally without touching the cluster, which is useful for review and for GitOps.

Helm’s real strength is consuming software built by others. Installing ingress-nginx, cert-manager or kube-prometheus-stack is one command with a values file, and the chart encodes hundreds of lines of manifests and upgrade knowledge you would otherwise maintain yourself. Charts can be published to OCI registries, supported as stable since Helm 3.8, so they can live next to your images.

Things to watch with Helm:

  • Template sprawl. Charts for internal services tend to grow a value for every field until the templates are harder to read than the YAML they generate. Expose only what actually varies.
  • Pin versions. Always install third-party charts with --version, and read release notes before bumping; chart majors often rename values.
  • Diff before upgrading. The helm-diff plugin shows what helm upgrade will change.
  • CRDs. Helm installs CRDs from a chart’s crds/ directory on first install but never upgrades or deletes them; many projects ship CRDs separately for this reason.

Kustomize

Kustomize keeps ordinary manifests in a base and expresses each environment as an overlay that patches it. It is built into kubectl as kubectl apply -k, and is also a standalone binary that tends to be newer.

billing-api/
  base/
    kustomization.yaml
    deployment.yaml
    service.yaml
  overlays/
    staging/
      kustomization.yaml
    production/
      kustomization.yaml
      resources-patch.yaml
# base/kustomization.yaml
resources:
  - deployment.yaml
  - service.yaml
labels:
  - pairs:
      app.kubernetes.io/name: billing-api
    includeSelectors: true
# overlays/production/kustomization.yaml
namespace: billing
resources:
  - ../../base
replicas:
  - name: billing-api
    count: 4
images:
  - name: ghcr.io/acme/billing-api
    newTag: "2.1.0"
patches:
  - path: resources-patch.yaml
configMapGenerator:
  - name: billing-config
    literals:
      - LOG_LEVEL=info
# overlays/production/resources-patch.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: billing-api
spec:
  template:
    spec:
      containers:
        - name: api
          resources:
            requests: { cpu: 500m, memory: 512Mi }
            limits:   { memory: 1Gi }
kubectl kustomize overlays/production     # render
kubectl diff -k overlays/production       # compare with the cluster
kubectl apply -k overlays/production

A detail worth knowing: configMapGenerator appends a hash of the content to the ConfigMap’s name and rewrites references to it. Changing a value therefore changes the name, which changes the pod template and triggers a rolling update. That fixes the well-known problem from the ConfigMaps article where pods keep stale environment variables after a ConfigMap edit.

Kustomize’s limits are the other side of its simplicity: no release history or rollback command, no hooks, and nothing like conditionals or loops. If an overlay starts needing logic, that is a sign you either want Helm or should simplify the differences between environments.

Using them together

The tools combine well. Kustomize can render a Helm chart through its helmCharts field (with --enable-helm) and then patch the output, which is useful when a third-party chart lacks a value for the one field you need to change. Alternatively, run helm template and treat the output as a Kustomize base.

In a GitOps setup, the tool that renders matters less than the flow. Argo CD and Flux both render Helm charts and Kustomize overlays natively, compare the result with the cluster and apply the difference. The environment’s desired state lives in Git, deploys are pull requests, and a rollback is a revert. Deploying with helm upgrade from CI, as in the Docker CI/CD article, still works well for smaller teams; GitOps adds value as the number of clusters and services grows.

Good practices for either tool

  • Keep environment differences small and intentional. Replicas, resources, hostnames and image tags should differ; container commands and probes usually should not.
  • Render and review. Run helm template or kubectl kustomize in CI, validate the output with kubeconform against the cluster’s Kubernetes version, and lint it with a policy tool.
  • Pin everything. Chart versions, image tags or digests and remote base references (?ref=v1.4.0 on Git URLs).
  • Keep secrets out of values files. Reference Secrets created by External Secrets Operator or encrypted with Sealed Secrets or SOPS rather than putting credentials in Git.
  • Use one tool per application. A team can use both, but layering three templating tools on one service makes every change a puzzle.

Frequently Asked Questions

What is the difference between Helm and Kustomize?

Helm generates manifests from Go templates and values files, packages them as versioned charts and tracks releases with upgrade and rollback. Kustomize starts from plain YAML and applies per-environment patches and transformations, with no templating and no release tracking. It is built into kubectl.

Should I use Helm or Kustomize for my own applications?

Either works. Kustomize suits teams that want readable plain YAML and small environment differences. Helm suits applications that need many configuration options, are installed by other teams, or benefit from release history and hooks.

Can Helm and Kustomize be used together?

Yes. Kustomize can render a Helm chart with its helmCharts field and patch the result, or you can render a chart with helm template and use the output as a Kustomize base. Argo CD and Flux support both.

Is Kustomize built into kubectl?

Yes. kubectl apply -k, kubectl kustomize and kubectl diff -k use a bundled version of Kustomize. The standalone kustomize binary is sometimes newer and supports a few more features.

One source, explicit differences

The tool matters less than the discipline: one shared definition, small reviewed differences per environment, pinned versions and rendered output checked before it reaches the cluster. Helm for what others build, Kustomize or Helm for what you build, and Git as the record of what is running. The official documentation is worth keeping open: the Helm documentation and the Kustomize task guide.

Originally posted on 17 October 2024 and post last modified on 17 October 2024

DevOps GitOps Helm Kubernetes Kustomize

Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *