1

I am using Kubernetes (specifically, I am using Azure Kubernetes Service, if that matters in this case). As far as I understand:

  1. I can use the preStop hook to execute some code before my pod is terminated.
  2. The preStop hook will be interrupted if it takes more seconds than what is defined by the terminationGracePeriodSeconds parameter.
  3. The preStop is executed at least once in any situation in which the pod will be terminated. That is what I understood from this documentation, although I may be making some mistaken assumptions.

I wanted to know: is there any case in which the preStop hook will not be called at all? For instance, if the pod is evicted or some other scenario.

Also: how safe is it to rely on this hook to execute some logic needed to save the state of the pod?

And, finally: I assume this hook will not be executed if the node (in which the pod "lives") crashes. Is that correct?

Alonso Montero
  • 138
  • 1
  • 8

0 Answers0