<p>My infrastructure has pods running on k8s with nginx sitting in the middle. According to the k8s pod lifecycle documentation, if you remove a pod, 1 second later it's removed from the endpoints list so no new requests are sent to it and nginx can no longer resolve it.</p>
<p>Am I correct in understanding that as soon as the pod is removed from the endpoints list that it's basically non-existent despite the fact that it's likely still alive and processing the SIGTERM request?</p>
<p>If yes, is there a way to give it a chance to complete in-flight requests while not accepting new ones?</p>

bitstream
<p>Yes you are right, as soon as pod is marked as <code>Terminating</code> it cannot (normally) receive traffic. If you want to ensure connections are drained, you use the <code>preStop</code> hook described here:</p>
<p>(<a href="https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-termination" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-termination</a>).</p>
<p>We use this to drain connections from our Varnish deployment before it terminates, because in our setup, they don't drain &quot;naturally&quot; fast enough, and connections are abruptly terminated when the pods get the SIGKILL signal.</p>
