kustomize
Customize Kubernetes configurations without modifying original YAML
TLDR
Create a kustomization file with resources and namespace
Build a kustomization file and deploy it with kubectl
Set an image in the kustomization file
Search for Kubernetes resources in the current directory to be added to the kustomization file
SYNOPSIS
kustomize command [options] [path]
PARAMETERS
build
Build complete YAML from kustomization in directory
create
Create skeleton kustomization directory structure
edit
Manipulate kustomization files (add/remove resources, set images, etc.)
fmt
Reformat and validate kustomization.yaml
cfg
Inspect/print kustomization configuration
version
Print kustomize version
--enable-alpha-plugins
Allow alpha (experimental) plugins
--enable-exec
Enable exec plugins (insecure, for remote execution)
--load-restrictor
Restrict loaded files (LoadRestrictionsNone|...|RootOnly)
-o, --output
Output to file instead of stdout
--output-map
Print field indexes for output objects
DESCRIPTION
Kustomize is a standalone tool for customizing raw, template-free Kubernetes YAML configurations declaratively. Using a kustomization.yaml file, it applies overlays, strategic merge patches, JSON 6902 patches, image transformations, namespace changes, common labels/annotations, and generators for ConfigMaps and Secrets from literals or files. It supports bases, resources, and remote fetching via Git or HTTP. The core workflow involves placing YAML files in a directory, defining transformations in kustomization.yaml, and running kustomize build to generate final YAML. Unlike templating tools like Helm, it avoids scripts or logic, promoting GitOps and reproducibility across environments (dev/staging/prod). Integrated into kubectl since v1.14 as kubectl kustomize and kubectl apply -k. Ideal for managing variants of Kubernetes manifests without duplication.
CAVEATS
Not installed by default; install via package managers or binaries. Alpha/exec plugins insecure. Relies on valid YAML input; errors can be verbose. Path-sensitive for relative refs.
INSTALLATION
Download from github.com/kubernetes-sigs/kustomize/releases or go install sigs.k8s.io/kustomize/kustomize/v5@latest.
Or via package: brew install kustomize (macOS), apt install kustomize.
BASIC EXAMPLE
Create kustomization.yaml:
{resources: [nginx.yaml], images: [{name: nginx, newName: mynginx/image}] }
Run: kustomize build . | kubectl apply -f -
HISTORY
Developed 2017-2018 by Kubernetes API Machinery SIG as KEP-593. Standalone release v2.0.3 (2019) by Michael Turek. Maintained by SIG-CLI. kubectl integration v1.14+. Current v5.x supports modern features like Helm chart inflation.


