繁体   English   中英

在 pod 触发 kubectl exec 命令后,如何查找以退出代码 137 错误终止的命令的日志

[英]How to find logs for command terminated with exit code 137 error after kubectl exec command is triggered at pod

我的 pod 已创建并在 pod 中执行以下命令时,有时会出现错误,因为命令以退出代码 137 终止

kubectl exec gradlecommandfromcommandline -- ./gradlew gatlingRun- 
simulations.RuntimeParameters -DUSERS=500 -DRAMP_DURATION
=5 -DDURATION=30

How to debug the problem,i mean what is the issue,mind you the same docker equivalent command runs fine with docker run,but issue is only after i execute kubectl exec command on pod,As i suspected memory issue in kubectl so i do specified memory 限制在“默认”命名空间内,使用下面

apiVersion: v1
kind: LimitRange
metadata:
name: mem-min-max-demo-lr
spec:
limits:
- max:
  memory: 1Gi
min:

  memory: 500Mi

type: Container

不幸的是kubectl exec没有调试标志1

您可以尝试使用kubectl logs gradlecommandfromcommandline收集一些日志,另外您可以打开第二个 session 并检查/var/log/中的容器日志,即使用tail -f /var/log/nginx/error.log


我还建议您测试减少命令参数并测试增加容器的资源。

最初,退出代码 137 意味着系统终止了容器,因为它试图使用比其限制更多的memory

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM