Kustomize

Kustomize

Same application, different environments - without templates. Plain YAML plus patches, built into kubectl.

graph TB B[base/<br/>deployment.yaml, service.yaml] --> D[overlays/dev<br/>1 replica, tag latest] B --> P[overlays/prod<br/>3 replicas, tag 1.28, limits] D -->|kubectl apply -k| C1[namespace dev] P -->|kubectl apply -k| C2[namespace prod]
app/
  base/
    kustomization.yaml
    deployment.yaml
    service.yaml
  overlays/
    dev/kustomization.yaml
    prod/kustomization.yaml
    prod/resources-patch.yaml
# overlays/prod/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
  - ../../base
namespace: prod
labels:
  - pairs: { env: prod }
    includeSelectors: false
images:
  - name: nginx
    newTag: "1.28"
replicas:
  - name: web
    count: 3
configMapGenerator:
  - name: web-cfg
    literals: [LOG_LEVEL=warn]
patches:
  - path: resources-patch.yaml
kubectl kustomize overlays/prod        # render
kubectl diff -k overlays/prod          # compare with the cluster
kubectl apply -k overlays/prod         # apply

configMapGenerator appends a content hash to the name (web-cfg-7g2h9) and updates the references - a changed config triggers a rollout automatically.

Helm or Kustomize?

HelmKustomize
Approachtemplates + valuesbase + patches
Good fordistributing software to othersyour own apps across environments
Release history, rollbackyesno (use git)
Toolingseparate binarykubectl -k

They combine: Argo CD and Flux render Helm charts and then apply Kustomize patches on top.

References