Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OOMKilled #45

Open
ianmiell opened this issue Jun 5, 2020 · 3 comments
Open

OOMKilled #45

ianmiell opened this issue Jun 5, 2020 · 3 comments

Comments

@ianmiell
Copy link
Collaborator

ianmiell commented Jun 5, 2020

No description provided.

@StevenACoffman
Copy link

StevenACoffman commented Sep 25, 2020

How do you detect OOMKilled events in your Kubernetes cluster?

We have been using log based metrics, looking for messages from kubelet like:

Memory cgroup out of memory: Kill process 1557026 (stress) score 1957 or sacrifice child
Killed process 1557026 (stress) total-vm:256780kB, anon-rss:100056kB, file-rss:264kB, shmem-rss:0kB

Although the OOMKilled event isn't present in the workload's (job or deployment) pod's logs, if you can detect that a pod was killed you can then use kubectl get pod -o go-template=... <pod-id> to determine the last termination reason.
As an example straight from the docs:

$ ./cluster/kubectl.sh  get pod -o go-template='{{range.status.containerStatuses}}{{"Container Name: "}}{{.name}}{{"\r\nLastState: "}}{{.lastState}}{{end}}'  simmemleak-60xbc
Container Name: simmemleak
LastState: map[terminated:map[exitCode:137 reason:OOM Killed startedAt:2015-07-07T20:58:43Z finishedAt:2015-07-07T20:58:43Z containerID:docker://0e4095bba1feccdfe7ef9fb6ebffe972b4b14285d5acdec6f0d3ae8a22fad8b2]]

@carvido1
Copy link
Contributor

An interesting go throw article about OOMKilled WTH! Who killed my pod - Whodunit?

@carvido1
Copy link
Contributor

There is a reported bug in java JDK-8230305 : Cgroups v2: Container awareness that can be fixed using JDK >= 11.0.16 because it uses cgroups v2, this was implemented in K8s 1.25 as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants