Skip to content

kx top

Lists pod or node CPU and memory usage with kubectl top, assigns indexes, and shows CPU%/MEM% — computed against each pod’s limits for pods, native to kubectl for nodes.

A flag kx doesn’t know is refused; put it after -- to pass it through to kubectl.

Usage

kx top [OPTIONS] [resource] [kubectl flags]

Arguments

ArgumentDescription
[resource]pods (the default) or nodes

Options

OptionDescription
-A, --all-namespacesList pods across every namespace; each row is indexed and carries its own namespace. Not for nodes, which are not in a namespace
--htmlRender the listing as HTML and serve it in a browser
--jsonPrint the listing as JSON instead of a table
-m, --match stringMatch by name (substring, case-insensitive)
-n, --namespace stringNamespace to list pods from; defaults to the current namespace. Not for nodes, which are not in a namespace
--no-headersLeave out the header row; kx can’t number a table without one
--no-limitsSkip the CPU%/MEM% columns (one fewer kubectl call)
--no-openServe the HTML report without opening a browser
--out stringWrite the HTML report to this file instead of serving it in a browser
--port intPort to serve the HTML report on; 0 picks a free one

Passthrough options

OptionDescription
--containersIf present, print usage of containers within a pod.
--field-selector stringSelector (field query) to filter on, supports ‘=’, ‘==’, and ‘!=’.(e.g. --field-selector key1=value1,key2=value2). The server only supports a limited number of field queries per type.
-l, --selector stringSelector (label query) to filter on, supports ‘=’, ‘==’, ‘!=’, ‘in’, ’notin’.(e.g. -l key1=value1,key2=value2,key3 in (value3)). Matching objects must satisfy all of the specified label constraints.
--show-capacityPrint node resources based on Capacity instead of Allocatable(default) of the nodes.
--show-swapPrint pod resources related to swap memory.
--sort-by stringIf non-empty, sort pods list using specified field. The field can be either ‘cpu’ or ‘memory’.
--sumPrint the sum of the resource usage
--use-protocol-buffersEnables using protocol-buffers to access Metrics API.
…kubectl’s global flags too: --context, --kubeconfig, --as and the rest; kubectl options lists them

Global options

OptionDescription
--no-colorDisable styled output
-h, --helpShow this message and exit

Examples

kx top
kx top nodes
kx top -m web
kx top --no-limits
kx top --html
kx top --json
kx top --out top.html
kx top --sort-by=memory