# Export plain YAML

Use `kix export` when you need a directory of Kubernetes manifests without
Kix's deployment records. The default export mode 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`.

Exit mode omits the `Activation` and `PackageInstance` objects, but includes
the two CustomResourceDefinitions for those kinds. The CRDs are ordinary
cluster-scoped resources in the graph, so they appear under `_cluster`. Remove
them manually if the receiving system should contain no Kix resources.

## 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/"
/>

Then confirm no Kix annotation survived the export. The search finds nothing
and exits with status 1, which is the result you want here:

<Command {...noAnnotations} />

That pattern matches annotation keys, where `kix.run` is followed by a slash.
It does not match the CRD names, where `kix.run` appears as a bare suffix.

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 the exact modes, directory
layout, and options.
:::