CLI Command Reference
This page lists every command and option of the kli CLI. For tasks that use these commands, refer to Inspect Workloads with the CLI.
To print the version of the CLI, run kli --version or kli -v. To print the help of a command, run the command with --help or -h.
The --catalog-experimental-definitions option, the --no-headers option, and -o wide for kli definitions are available in CLI builds after v0.3.0.
Commands
kli get
Lists workloads with a normalized phase, read through the definition that covers each type. The phase comes from the workload spec, so the output lists no pods.
The type match is lenient. It is not case-sensitive, and it accepts the singular, the plural, and the kubectl short names. The -o wide option adds the ORIGIN column, which shows where the definition that resolved the workload came from.
Examples:
kli describe
Shows one workload as it is read through the definition that covers its type. The output has the component tree with the live pods placed under the role that they play, the normalized phase, and the resources that each component requests.
The type match is lenient, as for kli get. kli places a pod by its ownership, so the output shows only the pods of this workload. It also uses the pod selectors of the definition, so a pod appears under the component whose role it plays.
With -f, kli builds the same view from a manifest alone, with no cluster and no pods. The structure and the desired scale are real, and everything live is absent. It looks up the definition in the built-in catalog and in the cluster, if it can reach one. It does not read a definition from a local file.
Examples:
kli definitions
Lists the definitions that the CLI understands. The list merges the built-in catalog with the definitions in the cluster. A definition in the cluster overrides a catalog definition that describes the same workload type, and it is listed once, with the origin cluster. Definitions are not namespaced. Without cluster access, the command still lists the catalog definitions.
Give a name to address one definition, or use --group, and optionally --kind and --version, to narrow the list to one workload type. The table is the view for people. The JSON and YAML output carry the definitions themselves, under an items key. A name addresses one definition, so the JSON and YAML output then contains that definition alone, and the output applies and validates as it is.
Examples:
kli validate
Checks a definition file before you apply it to a cluster. It checks the shape of the schema, the required fields, and the validity of the jq expressions.
Give a path, or - to read the definition from standard input. The validation is static and fully local, so the command needs no cluster and no kubeconfig. It reports whether the definition is well formed, not whether it maps a workload correctly. It also does not reject unknown field names.
The command has no options of its own. Its exit code is the interface for scripts. For the exit codes, refer to Exit Codes.
Examples:
kli completion
Generates the autocompletion script for a shell. The shells are bash, fish, powershell, and zsh.
For how to load the script, refer to Set Up Shell Completion.
Global Options
Every command accepts the following options.
Connection Options
kli reads your kubeconfig in the same way as kubectl, and it accepts the same connection options:
Config File and Environment Variables
kli reads a config file in YAML format. It looks for the file in the first of the following locations that applies:
- The path in the
--configoption. - The path in the
KARTA_CONFIGenvironment variable. $HOME/.karta/config.yaml. This file is optional.
The config file accepts the following keys. If the file has any other key, kli stops with an error.
An option overrides the environment variable, and the environment variable overrides the config file.
Exit Codes
When a command fails, kli prints a message that starts with error:. The exit code identifies the kind of failure.
For kli get and kli describe:
For kli validate: