Kustomize vs Helm#

Kustomize#

Kustomize provides a template-free way to customize Kubernetes objects.

File Structure#

Kustomize uses a base and overlay structure.

.
├── base
│   ├── kustomization.yaml
│   └── deployment.yaml
└── overlays
    ├── dev
    │   ├── kustomization.yaml
    │   └── patch.yaml
    └── prod
        ├── kustomization.yaml
        └── patch.yaml

Key Components#

  • kustomization.yaml: blueprint defining resources, generators, and patches
  • Build: generate manifests without applying
    • eg. kubectl kustomize <dir>
  • Apply: build and apply manifests
    • eg. kubectl apply -k <dir>

Deployment#

  • Prod Env:
    • eg. kubectl apply -k overlays/prod
  • Both Envs:
    • eg. kubectl apply -k overlays/dev && kubectl apply -k overlays/prod

Helm#

Helm is a package manager for Kubernetes.

File Structure#

Helm uses charts and value files for environment separation.

my-chart/
├── Chart.yaml          # Metadata
├── values.yaml         # Default configuration
├── values-dev.yaml     # Dev environment overrides
├── values-prod.yaml    # Prod environment overrides
└── templates/          # Kubernetes manifest templates
    └── deployment.yaml

Key Concepts#

  • Release: a chart instance combined with values running in a cluster

Deployment#

  • Prod Env:
    • eg. helm install <name> ./my-chart -f ./my-chart/values-prod.yaml
  • Both Envs:
    • eg. helm install <name>-dev ./my-chart -f ./my-chart/values-dev.yaml
    • eg. helm install <name>-prod ./my-chart -f ./my-chart/values-prod.yaml

CLI#

See Helm CheatSheet.

Comparison#

FeatureKustomizeHelm
ApproachOverlay/PatchTemplates
SyntaxNative YAMLGo text/template
CLIkubectl (built-in)helm