Commands
Every command below takes indexes from the listing kx get last produced. Run kx <command> --help for the same reference in the terminal.
Resources
| Command | Description |
|---|---|
kx annotate <index> [<key=value>...] [--overwrite] [--remove str] | Set or remove annotations on an indexed resource. |
kx annotations <index>... | Show annotations for one or more indexed resources. |
kx context [<index>] | List kubeconfig contexts, or switch to an indexed one; alias: kx contexts. |
kx cordon <index>... | Mark one or more indexed Nodes unschedulable. |
kx cp <src> <dest> [--container/-c str] [--no-preserve] [--retries int] [kubectl flags...] | Copy files to or from an indexed pod via kubectl cp. |
kx debug <index> [<command>...] [--image str] [--target str] [kubectl flags...] | Open a debug shell on an indexed Pod (an ephemeral container, for images with no shell) or Node (a privileged pod on the host). |
kx delete <index>... [--yes/-y] | Delete one or more indexed resources (prompts for confirmation unless --yes). |
kx describe <index>... [kubectl flags...] | Show full kubectl describe output for one or more indexed resources. |
kx diagnostic [<index>] [--all-namespaces/-A] [--fail-on str] [--full] [--html] [--json] [--namespace/-n str] [--no-open] [--out str] [--port int] | Diagnose an indexed Deployment, StatefulSet, DaemonSet, Job, CronJob, Service, PersistentVolumeClaim, Ingress, Pod, or Node, or triage a whole namespace when no index is given (-n to pick one, -A for every namespace); alias: kx diag. |
kx drain <index> [--delete-emptydir-data] [--force] [--grace-period int] [--ignore-daemonsets] [--timeout duration] [--yes/-y] [kubectl flags...] | Evict the pods from an indexed Node (prompts for confirmation unless --yes). |
kx edit <index> [kubectl flags...] | Open an indexed resource in your editor via kubectl edit. |
kx events <index>... | Show Kubernetes events for one or more indexed resources. |
kx exec <index> [<command>...] [kubectl flags...] | Open an interactive shell in an indexed Pod, Deployment, ReplicaSet, StatefulSet or DaemonSet (bash, falling back to sh). |
kx get <resource> [<index>...] [--all-namespaces/-A] [--decode] [--key/-k str] [--match/-m str] [--namespace/-n str] [--watch/-w] [--yes/-y] [kubectl flags...] | List resources and assign index numbers for use with other commands; shorthand: kx <kind> (e.g. kx pods, kx po 3). |
kx label <index> [<key=value>...] [--overwrite] [--remove str] | Set or remove labels on an indexed resource. |
kx labels <index>... [--selector/-s] | Show labels for one or more indexed resources; --selector formats output as a label selector. |
kx logs <index>... [kubectl flags...] | Stream logs for an indexed resource; aggregates across pods for Deployments, StatefulSets, DaemonSets, and Services. |
kx namespace [<index>] | List namespaces, or switch to an indexed one; alias: kx ns. |
kx port-forward <index> <port> [kubectl flags...] | Forward a local port to an indexed resource (Pod, Deployment, ReplicaSet, StatefulSet, DaemonSet, Service). |
kx rollout <action> <index> | Run a rollout action (status, restart, pause, resume, history, undo) on a Deployment, StatefulSet, or DaemonSet. |
kx scale <index> <replicas> | Scale an indexed Deployment, StatefulSet, or ReplicaSet to a given replica count. |
kx scan [<index>] [--all-namespaces/-A] [--engine str] [--fail-on str] [--full] [--html] [--json] [--namespace/-n str] [--no-open] [--out str] [--port int] [scanner flags...] | Scan the unique container images of an indexed workload for vulnerabilities, or a whole namespace when no index is given (-n to pick one, -A for every namespace); prints a severity summary table by default, or the raw scanner output with --full. Requires the CLI for the selected scan engine (Docker Scout by default; Trivy or Grype via --engine — see kx engine). |
kx secret [<index>...] [--all-namespaces/-A] [--decode] [--key/-k str] [--match/-m str] [--namespace/-n str] [--watch/-w] [--yes/-y] [kubectl flags...] | List Secrets like kx get, or show an indexed Secret’s data with --decode; alias: kx secrets. |
kx top [<resource>] [--all-namespaces/-A] [--html] [--json] [--match/-m str] [--namespace/-n str] [--no-limits] [--no-open] [--out str] [--port int] [kubectl flags...] | List CPU/memory usage for pods (default) or nodes and assign index numbers, like kx get; shows usage as a percent of limits (pods) or capacity (nodes) unless --no-limits. |
kx tree [<index>] [--all-namespaces/-A] [--html] [--json] [--namespace/-n str] [--no-index] [--no-open] [--out str] [--port int] | Show the ownership graph for an indexed resource, or the whole current namespace when no index is given (-n to pick one, -A for every namespace); assigns indexes to tree nodes by default. A Namespace index graphs that namespace. |
kx uncordon <index>... | Mark one or more indexed Nodes schedulable again. |
kx yaml <index>... [--show str] | Print the raw YAML manifest for one or more indexed resources; --show filters to specific top-level fields. |
History
| Command | Description |
|---|---|
kx state [<position>] [--all/-a] [--targets/-t] | Show current state, jump to a history position, list all entries with --all, or expand the switch targets with --targets. |
Configuration
| Command | Description |
|---|---|
kx engine [<name>] | List available scan engines or persist a default choice by name or index. |
kx theme [<name>] | List available color themes or persist a choice by name or index. |
Shell
| Command | Description |
|---|---|
kx completion | Generate a shell completion script for kx (bash, zsh, fish, powershell). |