How to allow long running application to complete request after SIGTERM is received in Kubernetes?

Viewed 30

I have a middleware application that sends requests to other services (could be WCF or REST) and the request completion time is variable.

If in case the application is performing a call that takes long time to complete and a SIGTERM is received, is it possible for the app to halt the pod termination until the operation can be completed?

I understand that Kubernetes has a terminationGracePeriodSeconds setting but what if the call to another service takes longer time than that and I don't want the app to be terminated immediately?

I also read that IApplicationLifetime.ApplicationStopping can be used to delay shutdown but I believe eventually a SIGKILL will be issued once a certain time is reached?

Thanks.

0 Answers
Related