Skip to content
Install the CLI

How-to guide Operate a cluster

Use snapshots for offline or CI diffs

These docs describe Kix's main branch, which can include changes not yet released. Read the docs for the latest release.

Use a snapshot when you want kix diff without a connection to the cluster: on a laptop off the VPN, in a CI job that holds no cluster credentials, or when several people need the same baseline for a review.

kix snapshot writes the fields Kix applied to each resource of the named cluster. kix diff --from then compares a build with that directory the same way kix plan --read-only compares with the live cluster, so the two reports match.

This guide assumes the cluster has been deployed at least once and that you can reach it when saving. The examples use the how-to-application cluster from kix-examples.

Take the snapshot right after a successful deploy, while the cluster and the source agree:

kix-examples/
❱ kix snapshot how-to-application --out ./snapshots/how-to-application
Discovering API resources...
Fetching managed resources (62 resource types)...
Fetched 15 resources
Saved 15 resources to ./snapshots/how-to-application/

Pass --context when the cluster is not the current kubectl context. The command reports how many resources it fetched and wrote. The directory holds one YAML file per resource, grouped by namespace, plus a README.md with the timestamp, cluster and context. Resources of other Kix clusters deployed to the same Kubernetes cluster are left out.

Compare the current source with the snapshot. No cluster access is needed:

kix-examples/
❱ kix diff how-to-application --from ./snapshots/how-to-application
4 packages: 4 unchanged, 0 changed, 0 added, 0 removed
No differences found.

Drift not checked: the deployed build is not on this machine, so Kix cannot tell which differences come from this build and which come from edits on the cluster (the deploy applies everything in the plan).

Straight after the save this reports no differences and exits with status 0.

Edit the source, then run the same command again. Changing the production message in the example cluster gives a report like this:

kix-examples/
❱ kix diff how-to-application --from ./snapshots/how-to-application
4 packages: 3 unchanged, 1 changed, 0 added, 0 removed

  how-to-app
    ~ production 1.0.0 (1 changed, 4 tracking annotation only)
      ~ ConfigMap/production@how-to-app
          ~ $.data.index.html:
              --- old
              +++ new
              @@ -1 +1 @@
              -Hello from production
              +Updated production message
      ~ Deployment.apps/production@how-to-app (tracking annotation only; no spec change or restart)
      ~ Job.batch/production-health@how-to-app (tracking annotation only; no spec change or restart)
      ~ PackageInstance.kix.run/production@how-to-app (tracking annotation only; no spec change or restart)
      ~ Service/production@how-to-app (tracking annotation only; no spec change or restart)

  Activation: how-to-application-6n94gibgl7zv -> how-to-application-2hrvz7i1aj05


Drift not checked: the deployed build is not on this machine, so Kix cannot tell which differences come from this build and which come from edits on the cluster (the deploy applies everything in the plan).

Made by a read-only comparison with the cluster. Not checked: admission webhooks, admission policies, field ownership conflicts, and invalid objects; `kix plan` checks them.
(exit code: 2)

The ConfigMap is the resource you edited. The four resources marked “via dependency” have no content change of their own; their identity hash moves because they depend on the ConfigMap, and Kix will re-stamp them on the next deploy. The command exits with status 2 whenever it finds a difference.

A snapshot describes the cluster at the moment it was taken. Once you deploy, save again, or the next diff will keep showing the change you already shipped. A simple rule: every command that deploys is followed by a save of the same context.

When you can reach the cluster, run kix plan how-to-application --read-only. It reads the same fields from the live resources and needs no saved copy.

A bundled build works as the baseline too. Package the cluster from the old revision with kix bundle, build a second bundle from the current revision, and compare the two:

kix-examples/
❱ kix bundle how-to-application --out before.kixbundle
❱ kix bundle how-to-application --out after.kixbundle
❱ kix diff how-to-application --bundle after.kixbundle --from-bundle before.kixbundle

You can also export the old revision with kix export --with-kix-metadata --out ./before and pass --from ./before. Both approaches compare two builds of the source without contacting a cluster. Use them to check what a branch changes relative to main.

Every resource shows as removed or cluster-level. The directory was written by kix export in its default mode, which strips the annotations the comparison needs. Save a snapshot instead, or export with --with-kix-metadata.

The diff reports changes you did not make. The snapshot is older than the last deploy. Save a fresh one and compare again.