I am working with Kubernetes
and a pod is composed by different containers.
I need to apply different behaviours when two specific events happen:
- a container (for whatever reason) have problems and need to be restarted. This happens when liveness probe fails
- a pod is scheduled to be stopped. For example I am rolling out a new version and kubernetes terminates the previous one and spin up the new one
From what I understood in both the cases kubernetes invokes the preStop
hook and sends a SIGTERM
, so it's impossible for me to understand in which of the two situations I am.
Is that right? Am I missing something?
Thanks