Kubernetes:哪个Pod在一个节点上使用最多的CPU?

bjg7j2ky  于 2022-10-06  发布在  Kubernetes
关注(0)|答案(2)|浏览(525)

有没有办法使用kubectl命令列出节点上使用最多CPU的所有Pod。我在官方文件中看不到这一点。

rsaldnfx

rsaldnfx1#

你可以通过使用

kubectl top pods    # This will give you which pod is using how much CPU and Memory

kubectl top nodes   # This will give you which node is using how much CPU and Memory

确保已在群集上部署指标服务器。

n6lpvg4x

n6lpvg4x2#

要了解特定节点上调度的哪个Pod的CPU请求最多,可以描述该节点并查看Non-terminated Pods部分。

kubectl describe node masternode

Non-terminated Pods:          (8 in total)
  Namespace                   Name                                        CPU Requests  CPU Limits  Memory Requests  Memory Limits  AGE
  ---------                   ----                                        ------------  ----------  ---------------  -------------  ---
  kube-system                 calico-kube-controllers-76d4774d89-vmsnf    0 (0%)        0 (0%)      0 (0%)           0 (0%)         30d
  kube-system                 calico-node-t4qzr                           250m (12%)    0 (0%)      0 (0%)           0 (0%)         30d
  kube-system                 coredns-66bff467f8-v9mn5                    100m (5%)     0 (0%)      70Mi (1%)        170Mi (4%)     30d
  kube-system                 etcd-ip-10-0-0-38                           0 (0%)        0 (0%)      0 (0%)           0 (0%)         30d
  kube-system                 kube-apiserver-ip-10-0-0-38                 250m (12%)    0 (0%)      0 (0%)           0 (0%)         30d
  kube-system                 kube-controller-manager-ip-10-0-0-38        200m (10%)    0 (0%)      0 (0%)           0 (0%)         30d
  kube-system                 kube-proxy-nf7jp                            0 (0%)        0 (0%)      0 (0%)           0 (0%)         30d
  kube-system                 kube-scheduler-ip-10-0-0-38                 100m (5%)     0 (0%)      0 (0%)           0 (0%)         30d

如果群集部署了metrics server,则以下命令有助于了解Pod和节点的CPU利用率

kubectl top podname
kubectl top nodename

相关问题