Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to track Kubernetes OOMKilled termination messages?

Tags:

kubernetes

When a Pod is evicted I'm supposed to find messages about the eviction at /dev/termination-log (or other path defined in terminationMessagePath property) inside the container filesystem.

I'm trying to track OOMKilled events, but after OOMKilled occured and the Pod was restarted, the /dev/termination-log is empty.
I tried to set terminationMessagePolicy property to FallbackToLogsOnError hoping to find out messages in container log and I did not find anything about the OOMKilled there.

By executing kubectl describe pod podname I can find out that the termination reason was OOMKilled, but I would like to be able to follow this events in order to integrate it with fluentd and logstash.

Our Kubernetes cluster version is v1.9.0 and it's running on-premise. The installation was done using kubeadm on top of CentOS 7.

like image 731
Matheus Neder Avatar asked Feb 22 '18 16:02

Matheus Neder


People also ask

How do I check my Kubernetes pod logs?

To get Kubectl pod logs, you can access them by adding the -p flag. Kubectl will then get all of the logs stored for the pod. This includes lines that were emitted by containers that were terminated.

What happens when POD is memory limit?

If the Container continues to consume memory beyond its limit, the Container is terminated. If a terminated Container can be restarted, the kubelet restarts it, as with any other type of runtime failure.


2 Answers

You can ssh to the machine the pod was running and exec journalctl -u kubelet

like image 190
Cindy Avatar answered Nov 15 '22 07:11

Cindy


The way I'm using - is looking to dmesg on nodes and track events from there

like image 34
Кирилл Семаев Avatar answered Nov 15 '22 09:11

Кирилл Семаев