kubectl 如何查看 node、pod 的 cpu、RAM 使用率?

先来看看 kubectl top 子命令的 help 信息

╰─➤  kubectl top --help     
Display Resource (CPU/Memory) usage.

 The top command allows you to see the resource consumption for nodes or pods.

 This command requires Metrics Server to be correctly configured and working on the server.

Available Commands:
  node          Display resource (CPU/memory) usage of nodes
  pod           Display resource (CPU/memory) usage of pods

Usage:
  kubectl top [flags] [options]

Use "kubectl  --help" for more information about a given command.
Use "kubectl options" for a list of global command-line options (applies to all commands).

通过 kubectl 查看 node 的 CPU、内存使用率

╰─➤  kb top node                         
NAME                            CPU(cores)   CPU%   MEMORY(bytes)   MEMORY%   
cn-hangzhou.172.16.240.110      3610m        92%    4765Mi          87%       
cn-hangzhou.172.16.240.137      1977m        50%    4998Mi          91%       
cn-hangzhou.172.16.36.167       2845m        72%    5614Mi          102%      
cn-hangzhou.172.16.6.124        757m         19%    5372Mi          98%       
cn-hangzhou.172.16.6.130        2717m        69%    5379Mi          98%       
cn-hangzhou.172.16.6.199        2045m        52%    6070Mi          106%      
cn-hangzhou.172.16.6.94         2701m        69%    5598Mi          98%       
virtual-kubelet-cn-hangzhou-i   8184m        0%     5746Mi          0% 

通过 kubectl 查看 pod 的 CPU、内存使用率

╰─➤  kb top pod -n vddb                       
NAME                                                    CPU(cores)   MEMORY(bytes)   
svddb-api-server-prod-57b8b7c78c-kxw6s                  277m         762Mi           
svddb-api-server-prod-57b8b7c78c-lkvxl                  3m           706Mi           
svddb-proxy-server-prod-7447b876f6-cnbzx                23m          141Mi           
svddb-proxy-server-prod-7447b876f6-glhmr                27m          155Mi           
svddb-proxy-server-prod-7447b876f6-mf6tl                26m          94Mi            
svddb-service-api-server-prod-85598c47f5-g58xt          3m           53Mi            
svddb-service-downloaders-server-prod-846bb8b45-74jl5   312m         147Mi           
svddb-service-downloaders-server-prod-846bb8b45-gd5ts   317m         151Mi           
svddb-service-generators-server-prod-74bc65bd5d-5sbhg   3746m        2784Mi          
svddb-service-generators-server-prod-74bc65bd5d-8wv9f   3731m        2641Mi          
svddb-service-monitor-server-prod-987cf45b9-bmvzq       0m           84Mi            
svddb-service-searcher-server-prod-5465bb6946-99rxd     32m          97Mi

你可能感兴趣的:(kubernetes)