i'm trying to find out how to get preStop
execution result for debugging purposes.
I'm creating a pod (not part of a deployment) with the following lifecycle definition:
terminationGracePeriodSeconds: 60
lifecycle:
preStop:
exec:
command:
- /bin/sh
- -c
- "echo trying post_stop;sleep 60"
when I ran it I can see it waiting 60 seconds but I cannot see any events for preStop
hook being triggers not when I run kubectl get events
and not when I run kubectl describe pod <my-pod>
more then that I would love to know where the logs of the hook is being written, I tried to run kubectl logs <my-pod> -f
but I did not see any logs there
You were on the right path with kubectl describe
, check out the following location: /dev/termination-log
see also the docs.