Hello everyone I can't find a way to provide a "graceful shutdown" in Nest microservices, in particular using NATS.
Expected behavior:
You can use the Kubernetes spec config to set the graceful shutdown for POD: terminationGracePeriodSeconds
Default value of terminationGracePeriodSeconds is 30 seconds
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: test
spec:
replicas: 1
template:
spec:
containers:
- name: test
image: ...
terminationGracePeriodSeconds: 60
Read best practise : https://cloud.google.com/blog/products/containers-kubernetes/kubernetes-best-practices-terminating-with-grace