Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 828
nickponline Avatar asked Jul 13 '17 17:07

nickponline


People also ask

What is OOM killed in Kubernetes?

What is OOMKilled (exit code 137) The OOMKilled error, also indicated by exit code 137, means that a container or pod was terminated because they used more memory than allowed. OOM stands for “Out Of Memory”. Kubernetes allows pods to limit the resources their containers are allowed to utilize on the host machine.

How do I check my pod status in Kubernetes?

Using kubectl describe pods to check kube-system If the output from a specific pod is desired, run the command kubectl describe pod pod_name --namespace kube-system . The Status field should be "Running" - any other status will indicate issues with the environment.

How do I check logs of crashed pods in Kubernetes?

Checking the logs of a crashed pod In case that a pod restarts, and you wanted to check the logs of the previous run, what you need to do is to use the --previous flag: kubectl logs nginx-7d8b49557c-c2lx9 --previous.

What happens when pod exceeds memory limit?

Q: What happens if a Kubernetes pod exceeds its memory resources 'limit'? It will be restarted. Unlike Pod eviction, if a Pod container is OOM killed, it may be restarted by the kubelet based on its RestartPolicy . You can Configure Out Of Resource Handling for your Node .


1 Answers

If the pod has already been deleted, you can also check kubernetes events and see what's going on:

$ kubectl get events

LAST SEEN   FIRST SEEN   COUNT    NAME                                               KIND                      SUBOBJECT                                     TYPE      REASON                SOURCE    MESSAGE
59m         59m          1        my-pod-7477dc76c5-p49k4                            Pod                       spec.containers{my-service}                   Normal    Killing               kubelet   Killing container with id docker://my-service:Need to kill Pod
like image 144
tayfun Avatar answered Oct 12 '22 20:10

tayfun