<p>I have a requirement of executing a sql query if some pod goes down . I wish to update records in database against the hostname of that pod , How can I possibly achieve this what are ways to do this?</p>

pawarchinmay27
<p>You can implement a handler in the application code which handles <code>SIGTERM</code> signal and make an entry to the DB. A <code>SIGTERM </code>signal is sent by kubernetes to the running pod before a <code>SIGKILL</code> is sent after the grace period mentioned by <code>terminationGracePeriodSeconds</code>.</p>
<p>As an alternative and safer approach you can offload this responsibility to another application which periodically polls a health-check endpoint exposed by the other app.The health check endpoint can expose the hostname of the app. When health-check fails make an entry to DB.</p>
