Live data from Hacker News

Guide to OOMKill Alerting in Kubernetes Clusters

netice9.com

21–30 of 33 posts

Re: Guide to OOMKill Alerting in Kubernetes Clusters

#21
post #15

At last year's KubeCon someone presented https://github.com/opsgenie/kubernetes-event-exporter

Not going to help you in this case; Kubernetes does not log an OOMKilled event. Issue tracking this has been open for some time: https://github.com/kubernetes/kubernetes/issues/69676

Tracking OOMKilled counts via the kubelet also had an open issue which was closed without being fixed: https://github.com/kubernetes/kubernetes/pull/87856

Re: Guide to OOMKill Alerting in Kubernetes Clusters

#23
post #17

Use serverless guys. k8s is a train wreck of needless complexity for 99% of developers.

The hate on K8s is misplaced in this case. You should redirect it to containers. Other container orchestration mechanisms will encounter similar, if not the same, issues.

Re: Guide to OOMKill Alerting in Kubernetes Clusters

#24
post #17

Use serverless guys. k8s is a train wreck of needless complexity for 99% of developers.

k8s unfortunately is the only way to maintain sanity if you want to maintain a multi-cloud environment. I don't relish the idea of duplicating functionality but maintaining code across aws lambda's and azure functions.

Re: Guide to OOMKill Alerting in Kubernetes Clusters

#25
post #5

Another hidden issue is that as a container gets close to running out of memory, it furiously drops read only pages from memory, only to need to read some of them back into memory moments later. This pathological swapping behavior can impact other workloads on the system. cgroups2 has better protections against this behavior.

This is why, without specific concerns, you set memory alerts at a high water mark rather than at full memory.

Re: Guide to OOMKill Alerting in Kubernetes Clusters

#26
post #20

What about healthchecks?

I don't think it would work to report an OOMkill. The process that would answer the healthcheck probe would be gone.

It's not clear to me what happens after the OOM. Does the init process restarts the daemon? I would argue that it shouldn't.

If the process stops responding to a healthcheck, it's the scheduler's responsibility (k8s in this case) to handle it. Crashes in this case should be handled in a similar way, whether it's due to OOM or a bug.

Maybe I'm missing another scenario here?

Re: Guide to OOMKill Alerting in Kubernetes Clusters

#27
post #17

Use serverless guys. k8s is a train wreck of needless complexity for 99% of developers.

Running out of memory vs wasting memory is also an issue on serverless although somewhat less extreme. Part of the issue is no one knows how much memory their code might use, and we don’t have frameworks that adapt to available memory much. Resource constrained computing is hard.

Re: Guide to OOMKill Alerting in Kubernetes Clusters

#28
post #20

What about healthchecks?

They are complementary.

If a sub-process gets OOMKilled and the container doesn't die, then it's most likely that the parent process didn't handle that scenario. In which case the health-check wouldn't cover that issue.

Re: Guide to OOMKill Alerting in Kubernetes Clusters

#29
post #5

Another hidden issue is that as a container gets close to running out of memory, it furiously drops read only pages from memory, only to need to read some of them back into memory moments later. This pathological swapping behavior can impact other workloads on the system. cgroups2 has better protections against this behavior.

How can you use cgroups2 for this? I know that BSD resource limits are basically useless for this as they only allow to limit virtual memory, not RSS use.

EarlyOOM [1] is a configurable daemon that kills processes early enough to (hopefully) prevent thrashing. I'm using it on my Linux desktops (it has proven to catch my own programs' runaway memory usage before it risks locking up the development machine), but it may also be useful on servers. It logs to syslog but also can be configured to run a program on kill events.

[1] https://github.com/rfjakob/earlyoom, https://launchpad.net/ubuntu/+source/earlyoom, https://packages.debian.org/search?keywords=earlyoom

(Why would a user space OOM killer be necessary if the kernel has better information about the state of the world? I don't know the details, but my interpretation is that because people disliked OOM killing, the kernel devs made the kernel OOM killer trigger so late that it is largely useless. If that's true and thus a social problem, maybe it needs to be solved on that level, too.)

BTW in my experience, Linux 2.2 used to handle out of memory situations much more gracefully than any later kernel version.

Re: Guide to OOMKill Alerting in Kubernetes Clusters

#30
post #12
post #6

Earlier quoted context omitted.

Sorry for that - seems I've under-estimated possible traffic. Scaled up the server a bit now.

Scaled up a blog... lol

When the blog is on a $5/month DO droplet and it does its own TLS termination that was necessary.
Post reply on HN