我正在尝试找出如何获取preStop
执行结果以进行调试。
我正在使用以下生命周期定义创建一个 pod(不是部署的一部分):
terminationGracePeriodSeconds: 60
lifecycle:
preStop:
exec:
command:
- /bin/sh
- -c
- "echo trying post_stop;sleep 60"
当我运行它时,我可以看到它等待了 60 秒,但是我看不到任何preStop
钩子事件被触发,而不是当我运行时kubectl get events
,而不是当我运行kubectl describe pod <my-pod>
更多时,我很想知道钩子的日志被写在哪里,我试过了运行kubectl logs <my-pod> -f
,但我在那里没有看到任何日志