【发布时间】:2021-07-02 22:55:29
【问题描述】:
我遵循了此页面中的第一个可能的解决方案:Checking kubernetes pod CPU and memory
我试过命令:
kubectl exec pod_name -- /bin/bash
但它不起作用,因此我尝试了命令:
kubectl exec -n [namespace] [pod_name] -- cat test.log
我知道这一点,因为当我运行命令时:
kubectl 获取 pod --all-namespaces | grep [pod_name]
这是我看到的:
但我收到此错误消息:
OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "exec: \"cat\": executable file not found in $PATH": unknown
command terminated with exit code 126
请告诉我如何解决这个问题?
##更新 用k9s工具也看不到CPU, MEM 完成的Pod,看不到CPU, MEM 完成的Pod正常吗?
【问题讨论】:
-
你可以使用 kubectl 命令 -
kubectl top pods -n %namespace% -
@shuti 你用的是什么容器镜像?
-
非常感谢您的回复@matt_j 事实上,我们的 kubernetes pod 托管了我们自己的应用程序平台,该平台在这个 pod 上运行模拟。我不确定我是否正确回答了你的问题。我们想检查通过此命令行完成运行的 pod 的 CPU 和 MEM,但出现错误。我看到了文档,它说选项
container_name是可选的? kubernetes.io/docs/tasks/debug-application-cluster/… -
感谢@Amit Baranes 的回复。您的命令有效,但它只显示仍在运行的 pod,对于那些已完成运行(已完成状态)的 pod,我再也看不到它们了。
标签: kubernetes memory cpu