<p>I noticed sometimes my containers are OOMKilled, but I'd like to print some logs before exiting. Is there a way that I can intercept the signal in my entrypoint script?</p>

Dagang
<p>Nevertheless the answer from DavidPi is already accepted, I don’t think it will work.
For more info you can check that question - <a href="https://stackoverflow.com/questions/49364568/analyze-kubernetes-pod-oomkilled">Analyze Kubernetes pod OOMKilled</a>, but I will add some info here.
Unfortunately you cannot handle OOM event somewhere inside Kubernetes or your app.
Kubernetes doesn’t manage memory limits itself, it just set settings for runtime below which actually execute and manage your payload.
Events from an answer above will allow you to get event when K8s generate them, but not when something else do it. In case of OOM, Kubernetes will get information about that event after your app will be already killed and container will be stoped, and you will not be available to run any code in your container on that event because it will be already stopped.</p>
