kubectl top查看k8s pod的cpu , memory使用率情况

To see the pods that use the most cpu and memory you can use the kubectl top command but it doesn’t sort yet and is also missing the quota limits and requests per pod. You only see the current usage:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ kubectl top pod --all-namespaces
NAMESPACE NAME CPU(cores) MEMORY(bytes)
kube-system kube-proxy-gke-rel3170- default -pool-3459fe6a 2m 12Mi
kube-system kube-proxy-gke-rel3170- default -pool-3459fe6a 2m 12Mi
kube-system fluentd-gcp-v2. 0.9 -5t9q6 8m 85Mi
kube-system fluentd-gcp-v2. 0.9 -pd4s9 10m 84Mi
kube-system kube-dns- 3468831164 -v2gqr 1m 26Mi
kube-system event-exporter-v0. 1.7 - 1642279337 -180db 0m 13Mi
kube-system kube-proxy-gke-rel3170- default -pool-3459fe6a 1m 12Mi
kube-system l7- default -backend- 3623108927 -tjm9z 0m 1Mi
kube-system kube-dns- 3468831164 -cln0p 1m 25Mi
kube-system fluentd-gcp-v2. 0.9 -sj3rh 9m 84Mi
kube-system kube-dns-autoscaler- 244676396 -00btn 0m 7Mi
kube-system kubernetes-dashboard- 1265873680 -8prcm 0m 18Mi
kube-system heapster-v1. 4.3 - 3980146296 -33tmw 0m 42Mi

Because of these limitations, but also because you want to gather and store this resource usage information on an ongoing basis, a monitoring tool comes in handy. This allows you to analyze resource usage both in real time and historically, and also lets you alert on capacity bottlenecks.

 

实际示例:

[root@]:~# kubectl top  pod   -n taobao-spider 
NAME                                                      CPU(cores)   MEMORY(bytes)   
app-1375507206-spider-new-v1-0-55f8cbb5cb-29wnz           0m           76Mi            
app-1375507206-spider-new-v1-0-55f8cbb5cb-2s2qj           0m           69Mi            
app-1375507206-spider-new-v1-0-55f8cbb5cb-6q9w7           0m           71Mi            
app-1375507206-spider-new-v1-0-55f8cbb5cb-7s59f           0m           74Mi            
app-1375507206-spider-new-v1-0-55f8cbb5cb-96lsb           0m           73Mi            
app-1375507206-spider-new-v1-0-55f8cbb5cb-fdglr           0m           71Mi            
app-1375507206-spider-new-v1-0-55f8cbb5cb-h52th           0m           71Mi            
app-1375507206-spider-new-v1-0-55f8cbb5cb-j26cx           0m           73Mi            
app-1375507206-spider-new-v1-0-55f8cbb5cb-k95gz           0m           71Mi            
app-1375507206-spider-new-v1-0-55f8cbb5cb-pv9w7           0m           75Mi            
app-1375507206-spider-new-v1-0-55f8cbb5cb-r9mtz           0m           69Mi            
app-1375507206-spider-new-v1-0-55f8cbb5cb-vq79m           0m           75Mi            
app-1375507206-spider-new-v1-0-55f8cbb5cb-xzzbs           0m           70Mi            
app-1375507206-spider-new-v1-0-55f8cbb5cb-zhjdb           0m           80Mi            
app-183215290-spider-v1-0-76f57788d-8jfqm                 93m          80Mi            
app-2492659469-spider-new-v1-0-7fbf4d7c7d-vf552           20m          61Mi            
app-3437963581-spider-v1-0-66cd9d7699-5z2vk               74m          108Mi           
app-3437963581-spider-v1-0-66cd9d7699-79bwf               54m          75Mi            

  

  • 1
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值