英文:
Co-relate cpu & mem usage from kubectl top pods and top command inside respective pod
问题
我想理解 "kubectl top pods" 输出与 POD 内执行的 Linux 命令 "top" 之间的关联。
它们如何相关?
虽然 top 显示当前的负载/使用状态以及 5 分钟和 15 分钟的详细信息,但 kubectl top pods 命令是否具有类似的功能?
提前感谢。
英文:
I wish to understand co-relation between "kubectl top pods" output and linux command "top" executed inside POD.
How do they co-relate ?
While top shows current load/usage status along with 5-min & 15-min details, do we have any such functionality for kubectl top pods command ?
Thanks in advance.
答案1
得分: 1
Kubectl top - 允许您查看节点或容器的资源消耗情况。此命令需要正确配置并在服务器上运行 Metrics Server。
top 命令用于显示 Linux 进程。它提供了运行中系统的动态实时视图。
如果在容器内运行 top,它就像在主机系统上运行一样,因为容器使用主机系统的内核。Unix top 使用 proc 虚拟文件系统并读取 /proc/meminfo 文件以获取有关当前内存状态的实际信息。容器内的容器部分共享 /proc,其中包括有关内存和 CPU 信息的路径。
要了解更多信息,请参考 Linux 中的 top 命令 和由 Kasper Siig 撰写的 Kubernetes Top pod/node。
英文:
Kubectl top - 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.
The top command is used to show the Linux processes. It provides a dynamic real-time view of the running system
If you run top inside the pod, it will be like you run it on the host system because the pod is using the kernel of the host system. Unix top uses the proc virtual filesystem and reads /proc/meminfofile to get actual information about current memory status. Containers inside pods partially share /proc with the host system include a path about memory and CPU information.
For more information refer to top command in linux and Kubernetes Top pod/node authored by Kasper Siig.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论