按每个节点 memory/cpu 对 kube pods 进行排序
Sort kube pods by memory/cpu per node
有没有办法结合kubectl top pod
和kubectl top nodes
?
基本上我想知道 pods 按 cpu/memory 用法 BY 节点排序。
对于具有 kubectl top pod
的整个集群,我只能按 memory/cpu 排序 pods,或者对于具有 kubectl top nodes
的整个节点直接使用 memory/cpu。
我一直在查看文档,但找不到确切的命令。
没有内置解决方案可以达到您的期望。 kubectl top pod
和 kubectl top node
是不同的命令,不能混用。只能通过 cpu
或 memory
:
从 kubectl top pod
命令中 sort results
kubectl top pod POD_NAME --sort-by=cpu # Show metrics for a given pod and sort it by 'cpu' or 'memory'
如果您想“结合”kubectl top pod
和 kubectl top node
,您需要编写自定义解决方案。例如 Bash 中的脚本基于 this commands.
有没有办法结合kubectl top pod
和kubectl top nodes
?
基本上我想知道 pods 按 cpu/memory 用法 BY 节点排序。
对于具有 kubectl top pod
的整个集群,我只能按 memory/cpu 排序 pods,或者对于具有 kubectl top nodes
的整个节点直接使用 memory/cpu。
我一直在查看文档,但找不到确切的命令。
没有内置解决方案可以达到您的期望。 kubectl top pod
和 kubectl top node
是不同的命令,不能混用。只能通过 cpu
或 memory
:
kubectl top pod
命令中 sort results
kubectl top pod POD_NAME --sort-by=cpu # Show metrics for a given pod and sort it by 'cpu' or 'memory'
如果您想“结合”kubectl top pod
和 kubectl top node
,您需要编写自定义解决方案。例如 Bash 中的脚本基于 this commands.