kustomize(1)
Kustomize lets you customize Kubernetes object configurations without modifying the original YAML files.
Synopsis
kustomize [command] [flags]Description
Kustomize is a template-free customization tool for Kubernetes manifests. It uses a declarative approach with a kustomization.yaml file to patch, overlay, and compose multiple Kubernetes resources from a base directory, enabling you to manage variants (dev, staging, prod) without duplicating YAML.
Rather than using template variables, Kustomize applies structural edits like adding prefixes/suffixes, merging configs, and strategic merge patches. The output is standard Kubernetes YAML that can be piped to kubectl apply.
Common options
| Flag | What it does |
|---|---|
build | Build a kustomization target; prints the generated manifests to stdout |
-o, --output | Output format (json, yaml); used with build to write to a specific format |
edit | Edit the kustomization.yaml file in the target directory |
version | Print the kustomize version |
--enable-alpha-plugins | Enable alpha plugins when building (for experimental features) |
--load-restrictor | Restrict file loading (none, LoadRestrictionsNone, LoadRestrictionsRootOnly) |
create | Create a new kustomization.yaml with scaffolding |
--namespace | Set the namespace for all resources in the kustomization |
Examples
Build the kustomization in ./base and apply the resulting manifests to the cluster
kustomize build ./base | kubectl apply -f -Build the production overlay and save the rendered output to a file
kustomize build ./overlays/production > prod-manifest.yamlBuild current directory in JSON format and extract all resource names
kustomize build . -o json | jq '.items[].metadata.name'Update the namespace in the kustomization.yaml to mynamespace
kustomize edit set namespace mynamespaceGenerate a kustomization.yaml by auto-detecting resources in ./manifests
kustomize create --autodetect ./manifestsPreview what would change in the cluster without applying
kustomize build ./base | kubectl diff -f -Add another kustomization as a resource to the current one
kustomize edit add resource ./other-baseBuild with experimental plugin support enabled
kustomize build --enable-alpha-plugins ./custom