简体   繁体   English

确定kubernetes pod重启原因

[英]Determining the cause of kubernetes pod restart

I'm running into issues with our Kubernetes deployment.我的 Kubernetes 部署遇到问题。 Recently we are running into a problem with one of the pods being restarted frequently.最近我们遇到了一个问题,其中一个 Pod 经常重启。

The service inside is using C++, with Google Logging and should dump a stacktrace on a crash (it does do that when run locally).里面的服务使用 C++ 和 Google Logging,并且应该在崩溃时转储堆栈跟踪(它在本地运行时会这样做)。

Unfortunately, the only log message I was able to find, related to the pod restart is from containerd , just saying "shim reaped".不幸的是,我能找到的与 pod 重启相关的唯一日志消息来自containerd ,只是说“shim reaped”。

Do I need to turn on some extra logging/monitoring to have the reasons for restart retained?我是否需要打开一些额外的日志记录/监控才能保留重启的原因?

Your can check crashed pod log by running您可以通过运行检查崩溃的 pod 日志

$ kubectl logs -f <pod name> -n <namespace> --previous

The pod could have been terminated for reasons like out of memory. pod 可能由于 memory 等原因而被终止。 Use kubectl describe pod <podname> which contains the information.使用kubectl describe pod <podname>包含信息。

There should be output like this (could also be a different reason than OOM):应该有这样的output(也可能是与OOM不同的原因):

    Last State:     Terminated
      Reason:       OOMKilled

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

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