用于查找每个节点内存消耗最高的 pod 的 kubectl 命令

sid*_*aid 4 kubernetes kubectl

kubectl top pod --all-namespaces | sort --reverse --key 4 --numeric | head -10给出集群中的顶级 Pod。如何获取每个节点内存消耗最高的 pod?

Kkk*_*Kkk 5

在 Ubuntu 中,这是对我有用的命令:

按内存使用情况排序:

kubectl get po -A -owide | grep ${NODE_NAME} | awk '{print $1, $2}' | xargs -n2 kubectl top pod --no-headers -n $1 | sort --key 3 -nr | column -t

按CPU使用率排序:

kubectl get po -A -owide | grep ${NODE_NAME} | awk '{print $1, $2}' | xargs -n2 kubectl top pod --no-headers -n $1 | sort --key 2 -nr | column -t