<p>I have containerized my ASP.NET Core 2.2 application into Docker image and then deployed it to Google Kubernetes Engine. Application regularly starts, but every now and then it just randomly shuts down. Log gives no special hints on what is going on, all I get is:</p>

<pre><code>I 2019-07-11T19:36:07.692416088Z Application started. Press Ctrl+C to shut down. 
I 2019-07-11T20:03:59.679718522Z Application is shutting down...
</code></pre>

<p>Is there any way I can get reason on why application is shutting down? I know you can register event handler on Shutdown like:</p>

<pre><code>public class Startup
{
    public void Configure(IApplicationBuilder app, IApplicationLifetime applicationLifetime)
    {
        applicationLifetime.ApplicationStopping.Register(OnShutdown);
    }

    private void OnShutdown()
    {
         //this code is called when the application stops
    }
}
</code></pre>

<p>But how would I extract reason for application shutdown from there?</p>

nikib3ro
<p>The problem was that by default my ASP.NET Core Web Api project did not handle root path. So <code>/</code> was hit by health check and when it didn't get <code>200 OK</code> back GKE would should down Kubernetes pod.</p>
