Kustomize — Template-Free Kubernetes Manifest Customization
Kustomize lets you customize Kubernetes manifests through overlays and patches without templates. Maintained by SIG CLI and built into kubectl, it is the declarative way to manage environment-specific YAML across dev/staging/prod.
What it is
Kustomize lets you customize Kubernetes manifests through overlays and patches without using templates. Maintained by SIG CLI and built into kubectl since version 1.14, it provides a declarative way to manage environment-specific YAML across dev, staging, and production. You keep a base set of manifests and layer environment-specific modifications on top.
Kustomize targets platform engineers, SREs, and DevOps teams who manage Kubernetes deployments across multiple environments and want to avoid the complexity of Helm's templating language.
How it saves time or tokens
Kustomize eliminates template syntax from your Kubernetes manifests. Your base YAML is valid Kubernetes YAML at all times, making it readable and testable without rendering. Overlays compose cleanly: you add patches, change image tags, or modify resource limits per environment without duplicating entire manifests. Since it is built into kubectl, there is no extra binary to install or maintain.
How to use
- Create a base directory with your Kubernetes manifests:
# base/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: api-server
spec:
replicas: 1
template:
spec:
containers:
- name: api
image: myapp:latest
resources:
limits:
memory: 256Mi
- Create a kustomization.yaml for the base:
# base/kustomization.yaml
resources:
- deployment.yaml
- service.yaml
- Create an overlay for production:
# overlays/production/kustomization.yaml
resources:
- ../../base
patches:
- patch: |-
- op: replace
path: /spec/replicas
value: 3
target:
kind: Deployment
name: api-server
images:
- name: myapp
newTag: v2.1.0
- Apply with kubectl:
kubectl apply -k ./overlays/production
Example
Preview the rendered output before applying:
kubectl kustomize ./overlays/production
# or standalone
kustomize build ./overlays/production
Related on TokRepo
- DevOps tools — infrastructure and deployment automation resources
- Featured workflows — curated developer resources across categories
Common pitfalls
- Deeply nested overlay structures become hard to reason about. Keep the overlay hierarchy to two levels (base + environment) for maintainability.
- Strategic merge patches silently ignore unknown fields. Validate your patches against the actual resource schema to catch errors early.
- Forgetting to list resources in kustomization.yaml means they are silently excluded from the build output.
Frequently Asked Questions
Helm uses Go templates to generate Kubernetes YAML, requiring a templating language and a values file. Kustomize uses plain YAML with overlays and patches. Kustomize is simpler for environment-specific customization; Helm is more powerful for packaging and distributing charts.
Yes. Since kubectl 1.14, you can use kubectl apply -k and kubectl kustomize natively without installing a separate binary. The standalone kustomize binary offers newer features that may not be in your kubectl version.
Yes. You can use Kustomize's helmCharts field to render Helm charts as part of a Kustomize build. This lets you apply Kustomize patches on top of Helm-rendered output.
Yes. Kustomize can generate ConfigMaps and Secrets from files or literals using configMapGenerator and secretGenerator. It appends content hashes to names for automatic rollout on changes.
Create separate overlay directories for each environment (dev, staging, production). Each overlay references the same base and applies environment-specific patches. Use kubectl apply -k ./overlays/production to deploy.
Citations (3)
- Kustomize GitHub— Kustomize is maintained by SIG CLI and built into kubectl
- Kubernetes Documentation— Overlay-based customization without templates
- Kustomize Reference— ConfigMap and Secret generation with content hashes
Related on TokRepo
Discussion
Related Assets
Conda — Cross-Platform Package and Environment Manager
Install, update, and manage packages and isolated environments for Python, R, C/C++, and hundreds of other languages from a single tool.
Sphinx — Python Documentation Generator
Generate professional documentation from reStructuredText and Markdown with cross-references, API autodoc, and multiple output formats.
Neutralinojs — Lightweight Cross-Platform Desktop Apps
Build desktop applications with HTML, CSS, and JavaScript using a tiny native runtime instead of bundling Chromium.