nais apply

nais apply PATH [flags]

Apply Nais resource manifests (YAML) to a specific team and environment. Accepts a single file or a directory containing multiple manifests. When a directory is given, mixin files (..yaml) are auto-loaded and --set/--append/--mixin flags are disabled.

Options

--allow-ignored-fields
Warn instead of failing when a manifest contains fields that nais apply ignores (e.g. METADATA.NAMESPACE or METADATA.ANNOTATIONS).
--append
Append one YAML value to a list as KEY=VALUE (e.g. spec.env={name: LOG_LEVEL, value: debug}). Creates missing lists. Can be repeated; applied in order after all –set overrides.
--dry-run
Preview which resources would be applied without making any changes.
--mixin
YAML FILE deep-merged over the base manifest (mixin values win). If omitted, an adjacent ..yaml is auto-loaded when present.
--set
Replace a field as KEY=VALUE using a dotted path with optional zero-based list indices (e.g. spec.env[0].value=debug). Values are parsed as YAML, including lists and maps. Can be repeated; applied in order.
--timeout
Maximum time to wait for resources to become ready when --WAIT is set. Examples: 30s, 5m, 10m.
--wait
Wait for applied resources to become ready before returning. Currently supported for APPLICATION resources; other kinds are skipped.

Inherited options

--config
Specify the PATH to the configuration file.
-e, --environment
Specify the ENVIRONMENT to use for this command. Overrides the default environment from configuration.
--no-colors
Disable colors in the output.
-t, --team
Specify the TEAM to use for this command. Overrides the default team from configuration.
-v, --verbose
Set verbosity level. Use -v for verbose, -vv for debug, -vvv for trace.

Examples

# Replace the environment variable list.
$ nais apply app.yaml --environment dev-gcp --team nais --set 'spec.env=[{name: LOG_LEVEL, value: debug}]'

# Update a field in an existing list element.
$ nais apply app.yaml --environment dev-gcp --team nais --set 'spec.env[0].value=debug'

# Append an environment variable without replacing existing entries.
$ nais apply app.yaml --environment dev-gcp --team nais --append 'spec.env={name: LOG_LEVEL, value: debug}'