# preStop lifecycle hook not executed not execued in containers(that are part of deployments

**URL:** <https://discuss.kubernetes.io/t/prestop-lifecycle-hook-not-executed-not-execued-in-containers-that-are-part-of-deployments/4485>\
**Category:** General Discussions\
**Created:** [February 6, 2019, 7:33am UTC](https://discuss.kubernetes.io/t/prestop-lifecycle-hook-not-executed-not-execued-in-containers-that-are-part-of-deployments/4485 "2019-02-06T07:33:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Latha\_Appanna](https://avatars.discourse-cdn.com/v4/letter/l/bbce88/32.png) [@Latha\_Appanna](https://discuss.kubernetes.io/u/Latha_Appanna)\
**Post date:** [February 6, 2019, 7:33am UTC](https://discuss.kubernetes.io/t/prestop-lifecycle-hook-not-executed-not-execued-in-containers-that-are-part-of-deployments/4485/1 "2019-02-06T07:33:23Z")

</div>

I’m trying to execute some command in preStop hook in container, but I don’t see anything in logs/events. Can someone please help me how to check preStop logs and verify if it was really execute?

`apiVersion: v1  
kind: Pod  
metadata:  
name: lifecycle-demo  
spec:  
containers:

- name: lifecycle-demo-container  
image: nginx  
lifecycle:  
postStart:  
exec:  
command: ["/bin/sh", “-c”, ’ echo “i: (date)”; ']  
preStop:  
exec:  
command: ["/bin/sh","-c","echo Hello from the preStop handler "]  
terminationGracePeriodSeconds: 180`

---

<div class="post-metadata">

**Author:** ![rata](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/rata/32/18244_2.png) [@rata](https://discuss.kubernetes.io/u/rata)\
**Post date:** [February 6, 2019, 12:44pm UTC](https://discuss.kubernetes.io/t/prestop-lifecycle-hook-not-executed-not-execued-in-containers-that-are-part-of-deployments/4485/2 "2019-02-06T12:44:32Z")

</div>

As a hack, if you redirect the echo to a file, and do a sleep afterwards, can’t you see the file created if you attach?
