# Export plain YAML

Use `kix export` when you need a directory of Kubernetes manifests without
Kix's deployment records. By default, the export removes Kix annotations and
omits `Activation` and `PackageInstance` resources.

## Export the cluster

Choose an output directory with `--out`:

<Command {...exportCluster} />

Kix evaluates and builds the cluster before writing the files. It does not
connect to Kubernetes.

The output is grouped by namespace. Cluster-scoped resources are written
under `_cluster`:

<Command {...exportFiles} />

Each filename contains the resource kind and name, such as
`how-to-app/Deployment-production.yaml`.

By default, `kix export` omits `Activation` and `PackageInstance` objects as
well as Kix's annotations (pass `--with-kix-metadata` to keep them). Kix's own
CustomResourceDefinitions are also absent from the export because builds do not
include them (Kix installs them directly on the cluster during deploys).

## Review the export

Compare the files with a live cluster before handing them to another system:

<Command
  commands={["kubectl diff --server-side -R -f ./handoff/"]}
  cwd="kix-examples/"
/>

The export strips all `kix.run/*` annotations from the exported manifests.
Labels such as `app.kubernetes.io/managed-by` remain part of the resource
metadata, so review and adjust labels if the receiving system has its own
ownership convention.

## Export again

Kix refuses to write into an existing output directory. Remove or archive the
previous export, or pass `--force` when replacing it is intentional:

<Command
  commands={[
    "kix export how-to-application --out ./handoff --force",
  ]}
  cwd="kix-examples/"
/>

`--force` clears the output directory before writing the new export. This
prevents stale YAML from recreating resources that have since been removed.
For safety, Kix clears only a tree containing directories and `.yaml` files,
which is the structure produced by an earlier export. If it finds any other
file or a symbolic link, it reports the path and refuses to continue. Remove
or relocate the directory yourself.

:::note[Reference]
See [`kix export`](/docs/reference/cli/export/) for what each export keeps, the directory
layout, and options.
:::