How can I log each time Kubernetes kills a process due to resource use?

5/3/2018

Is there any way to log this action / event?

It seems that if a process is using too much resources and is not the main process, it gets a SIGKILL signal. I'd like to log this action.

-- Chris Stryczynski
google-kubernetes-engine
kubernetes

1 Answer

5/3/2018

You can use posthook to a run scripts when container is getting terminated.

Use that script to send notification or to log info to STDOUT.

Later when pod get killed, We can still get the older logs by using -p flag in kubectl logs.

-- sairam546
Source: StackOverflow