Better example of a preStop hook for nginx (#12563)
It looks like `nginx -s quit` returns immediately rather than blocking until nginx has finished gracefully shutting down. As a result, just running `nginx -s quit` in the preStop hook won't work very well for high load and/or long running requests; nginx will get a TERM signal (and do a hard shutdown) immediately after `nginx -s quit` returns. (I was getting connection errors while terminating pods, and adding a sleep-until-done to the preStop hook seemed to make them go away.)
This commit is contained in:
committed by
Kubernetes Prow Robot
parent
c4a0e6be5c
commit
7f3eb1dac6
@@ -12,5 +12,5 @@ spec:
|
||||
command: ["/bin/sh", "-c", "echo Hello from the postStart handler > /usr/share/message"]
|
||||
preStop:
|
||||
exec:
|
||||
command: ["/usr/sbin/nginx","-s","quit"]
|
||||
command: ["/bin/sh","-c","nginx -s quit; while killall -0 nginx; do sleep 1; done"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user