<p>The Kubernetes documentation about <a href="https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/" rel="nofollow noreferrer">PreStop</a> hooks claims the following:</p>
<blockquote>
<p>PreStop hooks are not executed asynchronously from the signal to stop
the Container; the hook must complete its execution before the TERM
signal can be sent.</p>
</blockquote>
<p>However, it does not say anything about other containers in the pod.
Suppose <code>terminationGracePeriodSeconds</code> has not yet passed.</p>
<p>Are all containers in a pod protected from termination until the <code>PreStop</code> hook for each container finishes? Or does each PreStop hook only protect its own container?</p>

merlin2011
<p>I believe <code>preStop</code> hook only protects the container for which it's declared.</p>
<p>For example, in the following set up:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Pod
metadata:
  name: lifecycle-demo
spec:
  containers:
  - name: lifecycle-demo-container
    image: nginx
    lifecycle:
      preStop:
        exec:
          command: [&quot;/bin/sh&quot;,&quot;-c&quot;,&quot;sleep 15&quot;]
  - name: other-container
    image: mysql
    env:
    - name: MYSQL_ALLOW_EMPTY_PASSWORD
      value: &quot;true&quot;
</code></pre>
<p>If I terminate the pod, the mysql receives SIGTERM and shuts down immediately while the nginx container stays alive for extra 15 seconds due to its <code>preStop</code> hook</p>
