From ef1b3bfd4ea0c2311492303895ddcc0e478a02b6 Mon Sep 17 00:00:00 2001 From: Qiming Teng Date: Wed, 24 May 2023 12:07:55 +0800 Subject: [PATCH] Clarify the condition when preStop hook is invoked --- content/en/docs/concepts/workloads/pods/pod-lifecycle.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/content/en/docs/concepts/workloads/pods/pod-lifecycle.md b/content/en/docs/concepts/workloads/pods/pod-lifecycle.md index b209a6a65f..adee06c801 100644 --- a/content/en/docs/concepts/workloads/pods/pod-lifecycle.md +++ b/content/en/docs/concepts/workloads/pods/pod-lifecycle.md @@ -454,10 +454,11 @@ An example flow: as terminating (a graceful shutdown duration has been set), the kubelet begins the local Pod shutdown process. 1. If one of the Pod's containers has defined a `preStop` - [hook](/docs/concepts/containers/container-lifecycle-hooks), the kubelet - runs that hook inside of the container. If the `preStop` hook is still running after the - grace period expires, the kubelet requests a small, one-off grace period extension of 2 - seconds. + [hook](/docs/concepts/containers/container-lifecycle-hooks) and the `terminationGracePeriodSeconds` + in the Pod spec is not set to 0, the kubelet runs that hook inside of the container. + The default `terminationGracePeriodSeconds` setting is 30 seconds. + If the `preStop` hook is still running after the grace period expires, the kubelet requests + a small, one-off grace period extension of 2 seconds. {{< note >}} If the `preStop` hook needs longer to complete than the default grace period allows, you must modify `terminationGracePeriodSeconds` to suit this.