skip to content
Alvin Lucillo

Get node with the highest CPU consumption

/ 1 min read

The first command lists all nodes and their performance metrics sorted by the highest number of CPU. The second command takes that first row. Finally, the third command takes the first column of data.

cluster1-controlplane ~  k top nodes --sort-by=cpu --no-headers
cluster1-controlplane   577m   1%    1008Mi   0%
cluster1-node01         62m    0%    464Mi    0%
cluster1-node02         57m    0%    532Mi    0%

cluster1-controlplane ~  k top nodes --sort-by=cpu --no-headers | head -n 1
cluster1-controlplane   569m   1%    1009Mi   0%

cluster1-controlplane ~  k top nodes --sort-by=cpu --no-headers | cut -d' ' -f1
cluster1-controlplane
cluster1-node01
cluster1-node02