I am working on the graceful termination, and created a pre-stop script that execute before the pod termination which has the logic which communicate with application via API and based on the response will continue the termination. Is it possible to extend the grace period if the response from the application is not to terminate? , just like life cycle hook on AWS auto scale extend heartbeat timeout.
You must modify terminationGracePeriodSeconds if the preStop hook needs longer to complete.
lifecycle:
preStop:
exec:
command:
- sh
- '-c'
- sleep 30; echo terminated
terminationGracePeriodSeconds: 120