Hacker News new | ask | show | jobs
by 2-m3m3n70 3472 days ago
Not familiar with the specific terminology of Kubernetes (pets, sets, etc) but does this allow you configure the shutdown behavior of containers? There's a Mesos feature I saw discussed where you can tell it to ping a endpoint in your application and not terminate the container until it says it is OK / safe to do so - is the same possible in Kubernetes? Want to do a blue-green type deployment pattern but the old application containers cannot be shutdown until all sessions are terminated (maybe even up to 15 minutes).
2 comments

Set this to 900:

terminationGracePeriodSeconds

Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period will be used instead. The grace period is the duration in seconds after the processes running in the pod are sent a termination signal and the time when the processes are forcibly halted with a kill signal. Set this value longer than the expected cleanup time for your process. Defaults to 30 seconds.

See Pod lifecycle and handler:

http://kubernetes.io/docs/api-reference/v1/definitions/#_v1_...

http://kubernetes.io/docs/api-reference/v1/definitions/#_v1_...

edit: As soon I posted this I remembered this is a feature; deleted original hack. :)

You can use a combination of these to set a long grace period, and then have your pre-stop hook wait for your process to finish (whatever criteria you define as finished).

We chose to set a fixed upper bound to ensure outside administrators can observe the requested grace period when draining nodes or performing maintenance.