<p>I have deploy my application in kubernetes using deployment.</p>
<ol>
<li>Whenever user gets login to application pod will generate session for that user.</li>
<li>To maintain session stickiness I have set session cookie using Nginx ingress annotations.</li>
<li>When hpa scale down pods application user is phasing a logout problem when pod is get terminated. If ingress has generated a session using this pod. It needs to log in again.</li>
<li>What I want is some sort of graceful termination of the connection. when pod is in a terminating state it should serve existing sessions until grace period.</li>
</ol>

<blockquote>
<p>What i want is some sort of graceful termination of connection. when
pod is in terminating state it should serve existing sessions
until grace period.</p>
</blockquote>
<p>You can use the key in POD spec : <strong>terminationGracePeriodSeconds</strong></p>
<p>this will wait for the mentioned second and after that POD will get terminated.</p>
<p>You can read more at : <a href="https://cloud.google.com/blog/products/containers-kubernetes/kubernetes-best-practices-terminating-with-grace" rel="nofollow noreferrer">https://cloud.google.com/blog/products/containers-kubernetes/kubernetes-best-practices-terminating-with-grace</a></p>
