Skip to main content
In this guide, you’ll learn how to imperatively update your kustomization.yaml using the kustomize edit subcommands. Anything you normally declare in YAML—adding or removing labels, prefixes, namespaces, modifying images or replica counts—can also be done directly via the CLI. Before you start, check the help output for available subcommands:
You’ll see usage examples and commands such as:

Key Subcommands


edit set

Use kustomize edit set to change fields in your kustomization.yaml without editing it by hand.

Change an image tag

Resulting entry:

Set or update a namespace

Produces:
This command only updates your kustomization.yaml. It does not apply changes to your cluster.

Add common labels

Yields:

Set replica count for a Deployment

Adds:

edit add

The add subcommands let you generate ConfigMaps, Secrets, and include additional resources.

Add a ConfigMap generator

Generates:

Add a Secret generator

Produces:

Add a resource

Include external YAML manifests in your kustomization:
Results in:

Which kustomization.yaml Gets Updated?

If your project uses multiple overlays or bases, the file modified depends on where you run the command:
If there’s no kustomization.yaml in your current directory, you’ll see an error.

Watch Video

Practice Lab