kx diagnostic
Analyses health signals — replica counts, container states, resource usage and warning events — and reports findings by severity.
With no index, sweeps every workload in the current namespace, or in the namespace given by -n, or in every namespace with -A; -m narrows a sweep to the resources whose name matches. Healthy resources are left out of the terminal table by default; --full includes them. The HTML report (--html) always includes them.
A Node is diagnosed by index only — from kx get nodes or kx top nodes. Nodes are not namespaced, so they do not appear in a namespace sweep or in -A.
--since bounds how far back the report looks, in s, m, h or d: 90s, 30m, 12h, 7d. A fraction or a mixture works too — 1.5h, 1h30m — except with d, which takes a fraction but not a mixture: 1.5d, never 1d12h. Without it everything is reported, however old — which is what holds a resource at warnings, and a --fail-on gate red, over a failure from last month. Set diag_max_age in config.toml to choose a window once rather than per run.
A window only ever hides what finished: a warning event, a restart or OOMKill a container recovered from, a pod or run that failed. What is still going wrong is always reported, however long it has been going wrong — a container in CrashLoopBackOff or ImagePullBackOff, a Pending pod, a Service with no endpoints.
Every finding says which it is. ‘· for 24d’ is how long something has been true, and no window hides it; ‘· 2m ago’ is when something happened, and a narrow enough one will.
A schedule longer than the window wants a wider one: a weekly CronJob whose last run failed six days ago needs --since 7d.
Usage
kx diagnostic [OPTIONS] [index]Aliases
kx diag
Arguments
| Argument | Description |
|---|---|
[index] | Row number from the current listing, or @name for a mark; kx state or kx mark shows them |
Options
| Option | Description |
|---|---|
-A, --all-namespaces | Sweep every namespace; each row is indexed and carries its own namespace |
--fail-on string | Exit 2 when a verdict reaches this severity or worse (critical, warning) |
--full | Include healthy resources in the terminal table; the HTML report always includes them |
--html | Render the report as HTML and serve it in a browser |
--json | Print the report as JSON instead of a table |
-m, --match string | Match by name (substring, case-insensitive) |
-n, --namespace string | Namespace to sweep; defaults to the current namespace |
--no-open | Serve the HTML report without opening a browser |
--out string | Write the HTML report to this file instead of serving it in a browser |
--port int | Port to serve the HTML report on; 0 picks a free one |
--since string | Ignore anything that happened longer ago than this — events, past restarts, failed runs; s, m, h or d: 90s, 30m, 12h, 7d. Defaults to diag_max_age, which is unset: everything is reported |
Global options
| Option | Description |
|---|---|
--no-color | Disable styled output |
-h, --help | Show this message and exit |
Examples
kx diagnostic
kx diagnostic 1
kx diagnostic -n prod
kx diagnostic -m api
kx diagnostic -A
kx diagnostic --html
kx diagnostic -A --json
kx diagnostic --since 7d
kx diagnostic -A --fail-on critical --out report.html