π No Helm. No Templating. Pure YAML.
Helm templates are complex. Kustomize is built into kubectl. Overlay configs for dev, staging, prod. No new syntax to learn.
π Folder Structure
k8s/
βββ base/
β βββ deployment.yaml
β βββ service.yaml
β βββ kustomization.yaml
βββ overlays/
βββ dev/
β βββ replica_count.yaml
β βββ configmap.yaml
β βββ kustomization.yaml
βββ prod/
βββ replica_count.yaml
βββ ingress.yaml
βββ hpa.yaml
βββ kustomization.yaml
π Base Kustomization
# base/kustomization.yaml apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - deployment.yaml - service.yaml # Common labels for all resources commonLabels: app: myapp environment: base # Add prefix to all resources namePrefix: myapp- # Common annotations commonAnnotations: version: "1.0.0" built-by: kustomize
β Dev Overlay
# overlays/dev/kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../base
# Override replicas
patches:
- target:
kind: Deployment
name: myapp-
patch: |-
- op: replace
path: /spec/replicas
value: 1
# Add dev-specific config
configMapGenerator:
- name: app-config
literals:
- ENV=development
- DEBUG=true
# Set namespace
namespace: dev
# Apply command
# kubectl apply -k overlays/dev
π‘ Kustomize vs Helm
- Kustomize: No templating, pure YAML, built into kubectl
- Helm: Template language, requires Tiller (old) or Helm 3
- Kustomize for simple overlays, Helm for complex packaging
- Both can work together (Helm chart + Kustomize for patches)
“Helm templates made my head hurt. Kustomize is just YAML overlays. Dev, staging, prod configs are clean, readable, and maintainable. Switched all projects to Kustomize.”
