Google Cloud Professional Cloud Developer — Question 240

You noticed that your application was forcefully shut down during a Deployment update in Google Kubernetes Engine. Your application didn’t close the database connection before it was terminated. You want to update your application to make sure that it completes a graceful shutdown. What should you do?

Answer options

Correct answer: A

Explanation

The correct answer is A because handling a SIGTERM signal allows the application to execute cleanup processes, like closing database connections, before termination. Option B does not ensure graceful shutdown; it merely prevents forced shutdowns under certain circumstances. Option C increases the grace period but does not guarantee that the application will handle disconnections properly. Option D allows for a shutdown hook, but without handling SIGTERM directly in the application code, it may not address the database connection issue effectively.