kubectl命令,用于查找每个节点上消耗内存最多的Pod

时间:2019-08-13 02:31:35

标签: kubernetes kubectl

kubectl顶部容器--all-namespaces |排序-反向-键4-数字| head -10给出群集中的顶部容器。如何获得每个节点上消耗内存最多的容器?

3 个答案:

答案 0 :(得分:1)

如果仍然需要排序并保留每个节点Pod列表的前十个元素,则可以使用以下命令: <!DOCTYPE html> <html lang="en"> <head> <script language="javascript" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="hash.js"></script> <meta charset="UTF-8"> <title>Insert title here</title> </head> <body > <form name="fileForm"> <button onclick="b()">button</button> <input type="file" name="file1" id="inputFile" accept="video/*" /> <div id="tt"> </div> </form> </body> </html>

答案 1 :(得分:0)

kubectl描述节点node_name将为您提供如下内容。

  Namespace   Name  CPU Requests  CPU Limits    Memory Requests   Memory Limits     AGE
  ---------   ----  ------------  ----------    ---------------   -------------     ---
                    0 (0%)        0 (0%)        0 (0%)            0 (0%)            11d
                    200m (5%)     0 (0%)        400Mi (5%)        600Mi (8%)        22h
                    25m (0%)      1 (25%)       512Mi (6%)        0 (0%)            14d
                    25m (0%)      1 (25%)       512Mi (6%)        0 (0%)            14d
                    0 (0%)        0 (0%)        0 (0%)            0 (0%)            14d
                    10m (0%)      0 (0%)        0 (0%)            0 (0%)            14d
                    400m (10%)    2 (50%)       2176Mi (29%)      1Gi (13%)         14d
                    1100m (27%)   6800m (170%)  1134217728 (14%)  5073741824 (65%)  14d
                    100m (2%)     0 (0%)        100Mi (1%)        100Mi (1%)        14d
                    100m (2%)     0 (0%)        0 (0%)            0 (0%)            14d
                    0 (0%)        0 (0%)        0 (0%)            0 (0%)            14d
                    100m (2%)     400m (10%)    30Mi (0%)         200Mi (2%)        14d
                    100m (2%)     400m (10%)    200Mi (2%)        512Mi (6%)        14d
                    100m (2%)     400m (10%)    200Mi (2%)        512Mi (6%)        14d
                    110m (2%)     2010m (50%)   256Mi (3%)        1152Mi (15%)      14d

答案 2 :(得分:0)

尝试:

kubectl get pods --all-namespaces -o wide | grep <node> | grep Running | awk '{print $1" "$2}' | while read namespace pod; do kubectl top pods --no-headers --namespace $namespace $pod; done  | sort -t ' ' --key 2 --numeric --reverse

这会检查所有命名空间,以防您拥有

这在macOS上对我有效,其中xargs不接受相同的参数,但应在任何* nix系统中工作