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.
Things we've tried:
- Setting the
terminationGracePeriodSeconds
to3600
. Istio still shuts down after 5s. - 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.
- Setting
TERMINATION_DRAIN_DURATION_SECONDS
to3600
on the istio container. Istio keeps running until 3600s have elapsed, even if our service has finished shutting down. We tried callingcurl -XPOST http://127.0.0.1:15000/quitquitquit
to get Istio to shut down sooner but it remains running for the full time.
How can we get Istio to stay running long enough for our service to terminate gracefully, without having it stay running for too long?