<p>I'd like a multi-container pod with a couple of components:</p>

<ul>
<li>A "main" container which contains a build job</li>
<li>A "sidecar" container which contains an HTTP proxy, used by the "main" container</li>
</ul>

<p>This seems to fit well with the pod design philosophy as <a href="http://kubernetes.io/docs/user-guide/pods/#uses-of-pods" rel="noreferrer">described in the Kubernetes documentation</a>, but I believe so long as the "sidecar" runs, the pod is kept alive. In my case, the "main" container is not long-lived; once it exits, the "sidecar" should be terminated.</p>

<p>How can I achieve this?</p>

<p>A pod is running as long as one of the containers is running.  If you need them to exit together, you have to arrange that the sidecar dies.  We do not have a notion of "primary" vs "secondary" containers wrt lifecycle, though that's sort of interesting.</p>

<p>One option would be to use an emptyDir volume and write a file telling the sidecar "time to go".  The sidecar would exit when it sees that file.</p>
