Self-terminate multi-container pod from within


I’m looking to setup pods that are only temporary and must go away after a timeout period. They will host a bunch of containers and serve web pages. I want the pod to terminate itself after 30 minutes of inactivity (ie no web requests).

Is there a way to do this without giving the pod access to the API server? This would be straightforward with a single container pod (ie just exit the process with restart policy of never) but I can’t figure out how to do it for multicontainer pod.

Any help will be appreciated.

EDIT: I have found shareProcessNamespace in pod spec which is pretty close to what I want. Still, if there is any other way established way of doing this, I’d prefer that.