<p>Is it possible to create a pod that will run a container after the main container terminates? I am imagining something similar to an init container, except that runs at the end rather than at the beginning. (I would use this to look for various metadata files created by the main process and send them to our data warehouse)</p>

<p>No, there is not AFAIK. You would have to use pods hooks for that. You can read about pod hooks <a href="https://blog.openshift.com/kubernetes-pods-life/" rel="noreferrer">on this post</a></p>

<p><a href="https://i.stack.imgur.com/aMj6Z.png" rel="noreferrer"><img src="https://i.stack.imgur.com/aMj6Z.png" alt="enter image description here"></a></p>

<p>As explained on <a href="https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/" rel="noreferrer">Kubernetes documentation</a>, containers can access a hook by implementing and registering a handler for that hook. There are two types of hook handlers that can be implemented for Containers:</p>

<p>Exec - Executes a specific command, such as pre-stop.sh, inside the cgroups and namespaces of the Container. Resources consumed by the command are counted against the Container.
HTTP - Executes an HTTP request against a specific endpoint on the Container.</p>

<p>For your use case, I'd use <a href="https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/" rel="noreferrer">the pre-stop hook</a> to execute a command inside the container and look for those metadata files.</p>

<blockquote>
  <p>This hook is called immediately before a container is terminated. It is blocking, meaning it is synchronous, so it must complete before the call to delete the container can be sent. No parameters are passed to the handler.</p>
</blockquote>
