| name | kustomize |
| description | Kustomize Kubernetes manifest composition. This skill should be used when writing kustomization.yaml, base/overlays, Components, patches, replacements, generators, helmCharts, or transformers. |
| last_updated | "2026-03-09T00:00:00.000Z" |
Kustomize
Build Kubernetes manifests from bases + overlays without templating. Compose resources declaratively using patches, transformers, and replacements.
Core Concepts
| Kind | API Version | Purpose |
|---|
| Kustomization | kustomize.config.k8s.io/v1beta1 | Base or overlay - lists resources, patches, config |
| Component | kustomize.config.k8s.io/v1alpha1 | Reusable mixin - shared across multiple kustomizations |
Directory Conventions
apps/
_components/ # Shared components (prefixed _ to sort first)
domain/
kustomization.yaml # kind: Component
cluster-config.yaml
airgap/
kustomization.yaml # kind: Component - imagePullPolicy overrides
myapp/
base/
kustomization.yaml
deployment.yaml
service.yaml
overlays/
dev/kustomization.yaml
prod/kustomization.yaml
kustomization.yaml # Top-level, may reference base + components
Flat layout (no base/overlays) is fine for apps without environment variants.
Minimal Kustomization
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deployment.yaml
- service.yaml
- ../base
Base / Overlay Pattern
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../base
namespace: production
patches:
- path: patch-replicas.yaml
target:
kind: Deployment
name: myapp
CLI
kustomize build .
kustomize build . | kubectl apply -f -
kubectl apply -k .
kubectl kustomize .
kustomize build --enable-helm .
Task Reference
Composition
Transforms
Troubleshooting
Build Order
- Accumulate
resources (recursively)
- Apply
components
- Run
generators (ConfigMapGenerator, SecretGenerator)
- Apply
patches
- Apply
transformers (namespace, namePrefix, labels, images)
- Apply
replacements
Patches target resources by their original names (before namePrefix/nameSuffix).
Key Rules
- Never use deprecated
vars - use replacements instead
commonLabels applies to selectors too (can break updates) - prefer labels field (kustomize v5.0+) which skips selectors
- Resources must have unique
group/kind/namespace/name tuples
- Relative paths in
resources resolve from the kustomization.yaml location
patches with target selectors can match multiple resources; name supports regex
- Order of fields in kustomization.yaml does not affect build order
Integration
- For deploying kustomize apps via ArgoCD (overrides, multi-source, Helm inflation), see the argocd skill