Kustomize Cheat Sheet
Customize raw Kubernetes manifests per environment — patches, overlays, and bases without templating.
Kubernetes3 sections · 16 commands
⌘K
Building
4kubectl kustomize .Render the customized manifests
kustomize build overlays/prodBuild a specific overlay
kustomize build . | kubectl apply -f -Build and apply in one step
kubectl apply -k overlays/prodApply the kustomization directly
Structure
7kustomize initCreate a kustomization.yaml
kustomize edit add resource deployment.yamlAdd a resource to the base
kustomize edit add base ../baseAdd a base
kustomize edit add patch --kind Deployment patch.ymlAdd a strategic patch
kustomize edit set nameprefix dev-Prefix every resource name
kustomize edit set namespace NSMove everything into a namespace
kustomize edit set image IMAGE=TAGOverride an image
Patches & Transformers
5patchesStrategicMerge: [patch-replica.yml]Merge patch (works on most fields)
patches: [{ path: p.yml, target: { kind: Deployment } }]JSON6902 targeted patch
commonLabels: { env: prod }Add labels to every resource
configMapGenerator:Generate ConfigMaps from files
secretGenerator:Generate Secrets with hashed suffixes