0

I am trying to achieve graceful shutdown for my spring app which runs on kubernetes. I have defined preDestroy method to perform some cleanup before shutdown but I see that container is removed before preDestroy method completes his execution.

What am I doing wrong actually here ?

user1474111
  • 1,356
  • 3
  • 23
  • 47
  • Please link Kubernetes PreStop hook with Spring PreDestroy functionality of application. So that container will call the k8s prestop hook before being terminated. https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/ – Nataraj Medayhal Aug 02 '23 at 11:58
  • additionally, if your preDestroy method is already getting called but the pods killed beffore it actually finishes try setting a higher terminationGracePeriod – meaningqo Aug 02 '23 at 13:19
  • during that period can container send request outside of the pod ? – user1474111 Aug 03 '23 at 09:35

0 Answers0