簡體   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