Reference / CLI
export
These docs describe Kix's main branch, which can include changes not yet released. Read the docs for the latest release.
kix export builds the cluster’s activation and writes each resource to its
own YAML file. It does not contact a cluster. By default it writes plain
Kubernetes YAML with no Kix annotations or Kix-internal resources, which
kubectl, Flux, or Argo CD can apply. With --with-kix-metadata it keeps
everything as evidence of what Kix would deploy.
This page is hand-maintained. Check cli/kix-cli/src/cli.rs and
cli/kix-cli/src/commands/export.rs when in doubt.
Synopsis
Section titled “Synopsis”1kix export <CLUSTER> [--out <DIR>] [--with-kix-metadata] [--force]2 [--flake <FLAKE>]| Argument or flag | Default | Meaning |
|---|---|---|
<CLUSTER> | Cluster name to build. | |
--out <DIR> | ./kix-export | Directory to write. |
--with-kix-metadata | Off | Keep the kix.run/* annotations and Kix’s own records. See What is kept. |
--force | Off | Replace an existing output directory. See Overwriting. |
--flake <FLAKE> | . | Flake to build. |
-o has no effect. Progress and the summary line go to stderr; -q hides
them. See Global flags for
--override-input.
What is kept
Section titled “What is kept”kix.run/* annotations | Activation and PackageInstance resources | |
|---|---|---|
| Default | Removed | Skipped |
--with-kix-metadata | Kept, including the identity hash and package stamps a deploy writes | Written |
Every export drops null fields and writes keys in sorted order. Labels are written unchanged.
Layout
Section titled “Layout”Each resource is written to <DIR>/<namespace>/<Kind>-<name>.yaml.
Cluster-scoped resources go under <DIR>/_cluster/. An export written with
--with-kix-metadata is a valid baseline for
kix diff --from; a default export is
not, because the diff needs the Kix annotations.
Overwriting
Section titled “Overwriting”Without --force, an existing output directory is an error. With --force,
Kix deletes the directory and writes it again, so files from an earlier export
do not linger. It refuses when the directory holds anything other than
subdirectories and .yaml files, or a symlink, and names the first such entry.
Examples
Section titled “Examples”❱ kix export demo --out handoff/❱ kubectl diff --server-side -R -f handoff/❱ kix export demo --with-kix-metadata --out evidence/ --force Exit status
Section titled “Exit status”0 on success, 1 when the build fails or the output directory cannot be
written or replaced.