The library provides the resources to implement a graceful shutdown with Kubernetes. When running microservices in Kubernetes. We need to handle the termination signals emitted by Kubernetes. The simple app shown above, adds a graceful shutdown period of 5 seconds after which the hook, which takes care of closing the server with the help of our shutdown functionality, gets triggered. Upon sending a SIGINT or SIGTERM signal, the user can see that a grace period of 5 seconds after which a waiting async operation of 3 seconds takes place, and only then the message 'shutdown after graceful period' indicate the closing of the server will be displayed. The app also showcases the functionality of the "getHealthHandler". Upon requesting localhost:3000/health, the healthTest will return true and the message 'everything is great' indicating a positive health check should be displayed.

Features

  • Sample using the express framework
  • Documentation available
  • Examples available
  • Upon receiving a signal, place the service in unhealthy mode (/health route should return a status code 4xx, 5xx)
  • Add a grace period before shutting down to allow kubernetes to take your application off the loadbalancer
  • Close the server and any open connections

Project Samples

Project Activity

See All Activity >

Categories

Libraries

License

MIT License

Follow k8s-graceful-shutdown

k8s-graceful-shutdown Web Site

You Might Also Like
Our Free Plans just got better! | Auth0 by Okta Icon
Our Free Plans just got better! | Auth0 by Okta

With up to 25k MAUs and unlimited Okta connections, our Free Plan lets you focus on what you do best—building great apps.

You asked, we delivered! Auth0 is excited to expand our Free and Paid plans to include more options so you can focus on building, deploying, and scaling applications without having to worry about your secuirty. Auth0 now, thank yourself later.
Try free now
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of k8s-graceful-shutdown!

Additional Project Details

Programming Language

TypeScript

Related Categories

TypeScript Libraries

Registered

2024-01-18