<p>I have a .NET Core console application running in a docker container that I am deploying through Kubernetes.
When I update the deployment image, I would like to keep the existing pod around for a while, without accepting new connections, but to keep existing connections alive for a period to allow existing users to finish. </p>

<p>Looking at the Kubernetes docs, I thought that termination grace period seconds was the property to add, but it doesn't seem to be working. As soon as I change the image listed in the deployment then the existing pod is dropped - the grace period is not applied. </p>

<p>Does anyone have any ideas as to what I'm doing wrong in this instance? I can't see anything in the docs. </p>

<p>Bit from my .yml file below:</p>

<pre><code>spec: 
   terminationGracePeriodSeconds: 60
   containers:
       - name: myApplication
</code></pre>

MrC
<p>The way the grace period works is that the main docker process is immediately sent a SIGTERM signal, and then it is allowed a certain amount of time to exit on its own before it is more forcefully shutdown. If your app is quitting right away, it is because it quits when it gets this signal.</p>

<p>Your app could catch the SIGTERM signal, and then quit on its own after all the open operations complete.  Or it could catch the SIGTERM signal and just do nothing and wait for it to be forced down a different way.</p>
