简体   繁体   中英

Determining the cause of kubernetes pod restart

I'm running into issues with our Kubernetes deployment. Recently we are running into a problem with one of the pods being restarted frequently.

The service inside is using C++, with Google Logging and should dump a stacktrace on a crash (it does do that when run locally).

Unfortunately, the only log message I was able to find, related to the pod restart is from containerd , just saying "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

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

The pod could have been terminated for reasons like out of memory. Use kubectl describe pod <podname> which contains the information.

There should be output like this (could also be a different reason than OOM):

    Last State:     Terminated
      Reason:       OOMKilled

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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