<p>I have to changed the <code>terminationGracePeriodSeconds</code> from 30 to 120 in Kubernetes deployment manifest file but when I am deploying using helm:</p>
<pre><code>helm upgrade --install &lt;chartname&gt; --values &lt;valuesfilename&gt;
</code></pre>
<p>The old pods getting terminated immediately and new pods started running.</p>
<p>But the expected behavior is to keep the old pods in terminating state and continue its current processes for 120 seconds as defined.</p>
<p>What else could be missing here?</p>
<p>Does this solve my issue here?</p>
<pre><code>containers:
  - name: containername
    lifecycle:
      preStop:
        exec:
          command: [ &quot;/bin/sleep&quot;, &quot;20&quot; ]
</code></pre>
<p>One question I had is does adding sleep command stops execution of current processes of the pod and just sleeps while it is in terminating state?</p>

Bala krishna
<p>The Kubernetes parameter <code>terminationGracePeriodSeconds</code> decides on how much time Kubernetes waits until it forcefully kills your container. In other words, when Kubernetes wants to terminate your Pod, it does the following:</p>
<ol>
<li>Kubernetes sends <code>SIGTERM</code> to your container</li>
<li>Kubernetes waits max. <code>terminationGracePeriodSeconds</code> for the following sequence of operations to happen:
<ul>
<li>Container stops normally</li>
<li><code>PreStop</code> hook executes</li>
</ul>
</li>
<li>Kubernetes sends <code>SIGKILL</code> to your container (and your <code>PreStop</code> container) and therefore terminates them forcefully</li>
</ol>
<p>Note that your container and the <code>PreStop</code> containers are not executed at the same time, but synchronously, one by one.</p>
<p>Read more at <a href="https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#hook-handler-execution" rel="nofollow noreferrer">Kubernetes Hook Handler Execution</a>.</p>
