Search code examples
kuberneteskubectl

How do I check if a Kubernetes pod was killed for OOM or DEADLINE EXCEEDED?


I have some previously run pods that I think were killed by Kubernetes for OOM or DEADLINE EXCEEDED, what's the most reliable way to confirm that? Especially if the pods weren't recent.


Solution

  • If the pods are still showing up when you type kubectl get pods -a then you get type the following kubectl describe pod PODNAME and look at the reason for termination. The output will look similar to the following (I have extracted parts of the output that are relevant to this discussion):

    Containers:
      somename:
        Container ID: docker://5f0d9e4c8e0510189f5f209cb09de27b7b114032cc94db0130a9edca59560c11
        Image:      ubuntu:latest
        ...
        State:      Terminated
          Reason:       Completed
          Exit Code:    0
    

    In the sample output you will, my pod's terminated reason is Completed but you will see other reasons such as OOMKilled and others over there.