I have a containerized NestJS application. If I run it locally using docker, I can shut it down gracefully which I can see via logging. If I run the same container on AKS, there is no log output about shutting down on pod deletion. The pod rather stay in state Terminating for half a minute and is then deleted.
If I execute a shell inside the container on AKS, a ps
shows me, that my application is running with PID 1. If I send a SIGTERM to PID 1 using kill -15 1
, the application does neither log the signal, nor does it shut down while becoming unresponsive at the same time.
/app $ ps
PID USER TIME COMMAND
1 node 0:03 node main.js
18 node 0:00 sh
25 node 0:00 ps
/app $ kill -15 1
/app $ ps
PID USER TIME COMMAND
1 node 0:03 node main.js
18 node 0:00 sh
27 node 0:00 ps
If I do the same with the same container using docker locally, my application logs the received signal and shuts down.
/app $ ps
PID USER TIME COMMAND
1 node 0:03 node main.js
18 node 0:00 sh
25 node 0:00 ps
/app $ kill -15 1
/app $ <shell exited here as container was removed by docker>
What am I missing here?