Skip to content
Install the CLI

Reference CLI

graph

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

kix graph evaluates a cluster and prints the dependency graph between its rendered resources. It does not contact a cluster. An edge means one resource must be applied and ready before another. Edges come from the kix.run/depends-on annotations evaluation writes, which record values a resource reads from another (out references) and explicit requires or extraDeps.

This page is hand-maintained. Check cli/kix-cli/src/cli.rs, cli/kix-cli/src/commands/graph.rs, and cli/kix/src/cluster/graph.rs when in doubt.

kix graph <CLUSTER> [-o tree|dot|json|yaml] [--flake <FLAKE>] [--no-cache]
Argument or flagDefaultMeaning
<CLUSTER>Cluster name to evaluate.
-o, --outputtreetree, dot, json, or yaml, described below. yaml prints the JSON document as YAML.
--flake <FLAKE>.Flake to evaluate.
--no-cacheOffEvaluate from Nix instead of reading the eval cache.

After the graph, a line on stderr gives the resource and dependency counts; -q hides it.

FormatContent
treeEach root is a resource with no dependencies. Beneath each resource are the resources that depend on it, so a resource with several dependencies appears under each of them. A repeated path is marked (circular ref). A cluster with no resources prints (no resources).
dotA digraph with one box per resource. Edges point from the dependent resource to its dependency. Import PackageInstances are dashed and grey.
json{ "nodes": [...], "edges": [...] }. Each node has id, kind, group (omitted for core v1 kinds), name, namespace, identityHash, and isImport. Each edge has from (the dependent) and to (the dependency), both node ids.

Resource IDs have the form Kind.group/name@namespace, such as Deployment.apps/web@shop. Core v1 kinds omit .group (Service/web@shop), and cluster-scoped objects omit @namespace (Namespace/shop). The PackageInstance that stands for an import is labelled (import) in the tree and DOT output and has isImport: true in JSON.

❱ kix graph demo
❱ kix graph demo -o dot | dot -Tsvg > graph.svg
❱ kix graph demo -o json

0 when the cluster evaluates, 1 when it does not.