# Self-terminate multi-container pod from within

**URL:** <https://discuss.kubernetes.io/t/self-terminate-multi-container-pod-from-within/3712>\
**Category:** General Discussions\
**Created:** [December 4, 2018, 12:43am UTC](https://discuss.kubernetes.io/t/self-terminate-multi-container-pod-from-within/3712 "2018-12-04T00:43:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mansour](https://avatars.discourse-cdn.com/v4/letter/m/7cd45c/32.png) [@mansour](https://discuss.kubernetes.io/u/mansour)\
**Post date:** [December 4, 2018, 12:43am UTC](https://discuss.kubernetes.io/t/self-terminate-multi-container-pod-from-within/3712/1 "2018-12-04T00:43:14Z")

</div>

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](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.12/#podspec-v1-core) which is pretty close to what I want. Still, if there is any other way established way of doing this, I’d prefer that.
