Blog Logo

Avoiding Downtime in Rolling Deployments by Blocking SIGTERM

This post discusses the problem of seeing 502 error responses from your applications when theyre being upgraded using a rolling-upgrade deployment in Kubernetes. After upgrading a chart, and confirming that there the new pods were deployed and functioning, failed requests would still be seen for 10-20 seconds after each deploy. In this post, the author explains why this happens and shows how to work around it by hooking into ASP.NET Cores IHostApplicationLifetime abstraction. The post is part of a series on Deploying ASP.NET Core applications to Kubernetes, which covers topics such as an introduction to Kubernetes, configuring resources with YAML manifests, using Helm charts, setting environment variables, adding health checks, running database migrations, and more.