Relation between preStop hook and terminationGracePeriodSeconds

梦想与她 提交于 2019-12-06 06:29:11

what kind of processes are allowed(recommended) for a preStop hook? As copying logs/heapdumps of 15 gigs or more will take a lot of time. This time will then be used to define terminationGracePeriodSeconds

Anything goes here, it's more of an opinion and how you would like your pods to linger around. Another option is to let your pods terminate and store your data in some place (i.e, AWS S3, EBS) where data will persist past the pod lifecycle then use something like Job to clean up the data, etc.

what happens when preStop takes more time than the set gracePeriod? (in case logs are huge say 10 gigs)

Your preStop will not complete which may mean incomplete data or data corruption.

what happens if I do not have any hooks but still set terminationGracePeriodSeconds ? will the container remain up until that grace time ?

This explains the sequence (from here):

  • A SIGTERM signal is sent to the main process in each container, and a “grace period” countdown starts.
  • If a pod has a preStop hook its invoked inside the container.
  • If a container doesn’t terminate within the grace period, a SIGKILL signal will be sent and the container.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!