I have a docker container based on php:7.2-apache-stretch running in kubernetes/rancher. The current k8s memory limit is excessively low, so users get errors and truncated pages when worker processes get oomkill'd. Since the httpd parent process isn't getting killed, my container doesn't die or restart, which I would see logs for. I was also surprised to not see any logs in the container's stdout/stderr when these processes get killed.
Before upping the ram limit to a more reasonable value, I was hoping to understand how to build logging/alerting around this condition.
Are there standards/best practices for monitoring/alerting on these memory events?
Potential options I've considered but haven't been able to figure out:
- Configure k8s/rancher to log oom-killer events somewhere (or learn where they are)
- Configure Apache parent process to die if a worker is killed by oomkiller
- Configure Apache to log to stderr when a worker process is killed.
- Configure Apache to run with a single process? Maybe the default apache mpm config is non-ideal for containerization.
- Switch to a different web server?
- Other ideas?