title: How can I prevent Istio sidecar from shutting down before my service has finished gracefully terminating?
body: <p>We have a service that needs to run a few longer SQL queries when it shuts down. However, when the pod receives a SIGTERM from Kubernetes, the istio proxy container waits only 5s prior to shutting down. This causes our queries to fail and the service terminates ungracefully.</p>
  <p>Things we've tried:</p>
  <ul>
  <li>Setting the <code>terminationGracePeriodSeconds</code> to <code>3600</code>. Istio still shuts down after 5s.</li>
  <li>Keeping an HTTP connection open to try to force Istio not to shut down. Istio still shuts down, forcing our HTTP connection to close too.</li>
  <li>Setting <code>TERMINATION_DRAIN_DURATION_SECONDS</code> to <code>3600</code> on the istio container. Istio keeps running until 3600s have elapsed, even if our service has finished shutting down. We tried calling <code>curl -XPOST http://127.0.0.1:15000/quitquitquit</code> to get Istio to shut down sooner but it remains running for the full time.</li>
  </ul>
  <p>How can we get Istio to stay running long enough for our service to terminate gracefully, without having it stay running for <strong>too</strong> long?</p>