<p>It is a recommended best practice to not run dockerized Node.JS applications as PID 1 (see <a href="https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md#handling-kernel-signals" rel="noreferrer">https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md#handling-kernel-signals</a>) in order to correctly capture signals.</p>

<p>The <code>docker run</code> command provides the <code>--init</code> flag to wrap the application entry point with a small init system that forwards signals correctly.</p>

<p>Is there a built-in equivalent of the <code>--init</code> flag in Kubernetes?</p>

<p>I've explored the Pod and Container object specifications for Kubernetes 1.10 but have not seen anything related to specifying how the image gets started.</p>

<p>An alternative would be to explicitly include and use <a href="https://github.com/krallin/tini" rel="noreferrer">Tini</a> in every container, but I would really like some way that does it transparently the way the <code>--init</code> flag behaves.</p>

<p>Are there other alternatives?</p>

<p>If you enable process (PID) namespace sharing for your pods, the init process (<code>pause</code>) will come from Kubernetes. If you have a separate process namespace for your containers, they need to include <code>tini</code> or another init process themselves.</p>

<p>According to <a href="https://www.ianlewis.org/en/almighty-pause-container" rel="noreferrer">https://www.ianlewis.org/en/almighty-pause-container</a>, Kubernetes 1.7 had a shared process namespace by default and a kubelet flag to disable it, 1.8 had it off by default and a kubelet flag to enable it. Kubernetes 1.11 has an alpha feature to enable a shared process namespace:
<a href="https://kubernetes.io/docs/tasks/configure-pod-container/share-process-namespace/" rel="noreferrer">https://kubernetes.io/docs/tasks/configure-pod-container/share-process-namespace/</a></p>
