title: Is there a way to configure Istio to route traffic to a POD which is in the terminating state?
body: <p>I have a Kubernetes cluster with two services deployed: SvcA and SvcB - both in the service mesh. </p>
  
  <p>SvcA is backed by a single Pod, SvcA_P1.  The application in SvcA_P1 exposes a PreStop HTTP hook.  When performing a "kubectl drain" command on the node where SvcA_P1 resides, the Pod transitions into the "terminating" state and remains in that state until the application has completed its work (the rest request returns and Kubernetes removes the pod).  The work for SvcA_P1 includes completing ongoing in-dialog (belonging to established sessions) HTTP requests/responses.  It can stay in the "terminating" state for hours before completing.</p>
  
  <p>When the Pod enters the "terminating" phase, Istio sidecar appears to remove the SvcA_P1 from the pool.  Requests sent to SvcA_P1 from e.g., SvcB_P1 are rejected with a "no healthy upstream".</p>
  
  <p>Is there a way to configure Istio/Envoy to:</p>
  
  <ol>
  <li>Continue to send traffic/sessions with affinity to SvcA_P1 while in "terminating" state?</li>
  <li>Reject traffic without session affinity to SvcA_P1 (no JSESSIONID, cookies, or special HTTP headers)?</li>
  </ol>
  
  <p>I have played around with the DestinationRule(s), modifying <code>trafficPolicy.loadBalancer.consistentHash.[httpHeaderName|httpCookie]</code> with no luck.  Once the Envoy removes the upstream server, the new destination is re-hashed using the reduced set of servers.</p>
  
  <p>Thanks,</p>
  
  <p>Thor</p>