<p>I have a K8s job that spins up a pod with two containers. Those containers are client and a server. After the client did all it needs to, it sends a special stop signal to the service after which the service exits; then client exits. The job succeeds.</p>
<p>The client and the service containers use <a href="https://www.eclipse.org/jetty/documentation/jetty-9/index.html" rel="nofollow noreferrer">jetty</a> (see &quot;Startup / Shutdown Command Line&quot;), which has that signaling capability. I am looking for something more portable. It would be nice, to be able to send a SIGTERM from the client to the service, then the client would not need to use <code>jetty</code> for signaling.  Is there a way to send SIGTERM from the client container to the server container. The client and the server processes are PID 1 in their respective containers.</p>

Anton Daneyko
<p>Yes, enable <code>shareProcessNamespace</code> on the pod, for example:</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: app
spec:
  shareProcessNamespace: true
</code></pre>
<p>Your containers can now send signals to one another. They will no longer use PID 1 anymore though.</p>
<p>Here are the docs that explain it all in detail:</p>
<p><a href="https://kubernetes.io/docs/tasks/configure-pod-container/share-process-namespace/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/configure-pod-container/share-process-namespace/</a></p>
