LinuxCommandLibrary

kubectl-top

displays resource usage for nodes or pods

TLDR

Show node resource usage

$ kubectl top nodes
copy
Show pod resource usage
$ kubectl top pods
copy
Show pod usage in namespace
$ kubectl top pods -n [namespace]
copy
Show container-level usage
$ kubectl top pods --containers
copy
Sort by CPU
$ kubectl top pods --sort-by=cpu
copy

SYNOPSIS

kubectl top type [options]

DESCRIPTION

kubectl top displays resource usage (CPU and memory) for nodes or pods. Requires metrics-server to be running in the cluster. Useful for monitoring resource consumption and identifying resource-hungry workloads.

PARAMETERS

nodes

Display node resource usage.
pods
Display pod resource usage.
--containers
Show container-level metrics.
--sort-by field
Sort by cpu or memory.
-n, --namespace name
Kubernetes namespace.
-A, --all-namespaces
Show all namespaces.

CAVEATS

Requires metrics-server installed in the cluster. Metrics may have a delay of up to one minute.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community