LinuxCommandLibrary

kubectl-kustomize

Customize Kubernetes configurations

TLDR

Build resources from the current directory

$ kubectl kustomize
copy

Build resources from a specific directory
$ kubectl kustomize [path/to/directory]
copy

Build resources from a remote URL
$ kubectl kustomize [https://github.com/user/repo/path]
copy

Build resources and save to a file
$ kubectl kustomize [path/to/directory] > [output.yaml]
copy

Build resources with load restrictor disabled
$ kubectl kustomize --load-restrictor [LoadRestrictionsNone] [path/to/directory]
copy

SYNOPSIS

kubectl-kustomize <DIR|URL> [flags]

PARAMETERS

--enable-alpha-plugins
    Enable alpha plugin support. (default true)

--enable-exec
    Enable exec plugin support. Deprecated, will be removed in v5.0.0. (default true)

--enable-helm
    Process helmCharts defined in kustomization.yaml

--helm-command
    Helm binary to use. (default "helm")

--helm-suffix
    Suffix appended to generated images. (default ".helm")

--load-restrictor
    Restrict file/dir loading: LoadRestrictionsRootOnly|LoadRestrictionsNone. (default "LoadRestrictionsRootOnly")

-h, --help
    Display help

--validation
    Validation mode: client|server|none. (default "server")

DESCRIPTION

The kubectl-kustomize command is the legacy standalone binary for the Kustomize kubectl plugin, used to assemble Kubernetes manifests from a directory containing a kustomization.yaml file.

Kustomize enables declarative configuration management by applying overlays, patches, and generators to base Kubernetes YAML files without using templates or parameterization. It reads the kustomization.yaml to define resources, patchesStrategicMerge, patchesJson6902, configMapGenerator, secretGenerator, and more, then outputs a consolidated set of YAML manifests suitable for kubectl apply.

Originally developed as a kubectl plugin, it allows customization of deployments across environments (dev, staging, prod) via directory-based structures. Common workflow: place bases in subdirs, define kustomization.yaml with patches, run kubectl-kustomize build . to generate output.

It supports Helm chart integration, remote bases via Git URLs, and validation. Deprecated in favor of built-in kubectl kustomize (since v1.14) and standalone kustomize binary.

CAVEATS

Legacy kubectl plugin; use built-in kubectl kustomize or standalone kustomize. Does not support all modern features like generators in newer versions.

TYPICAL USAGE

kubectl-kustomize build ./overlays/prod | kubectl apply -f -
kubectl-kustomize build https://github.com/example/base.git

HISTORY

Developed by Kubernetes SIG CLI in 2018 as kubectl-kustomize plugin binary for pre-v1.14 kubectl. Integrated into kubectl core in v1.14 (2019). Standalone kustomize evolved separately under Kubernetes org, now at v5+ with CNCF incubation.

SEE ALSO

kubectl(1), kustomize(1), helm(1)

Copied to clipboard