You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/docs/concepts/containers/container-lifecycle-hooks.md
+16-17Lines changed: 16 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,10 +36,13 @@ No parameters are passed to the handler.
36
36
37
37
`PreStop`
38
38
39
-
This hook is called immediately before a container is terminated due to an API request or management event such as liveness probe failure, preemption, resource contention and others. A call to the preStop hook fails if the container is already in terminated or completed state.
40
-
It is blocking, meaning it is synchronous,
41
-
so it must complete before the signal to stop the container can be sent.
42
-
No parameters are passed to the handler.
39
+
This hook is called immediately before a container is terminated due to an API request or management
40
+
event such as a liveness/startup probe failure, preemption, resource contention and others. A call
41
+
to the `PreStop` hook fails if the container is already in a terminated or completed state and the
42
+
hook must complete before the TERM signal to stop the container can be sent. The Pod's termination
43
+
grace period countdown begins before the `PreStop` hook is executed, so regardless of the outcome of
44
+
the handler, the container will eventually terminate within the Pod's termination grace period. No
45
+
parameters are passed to the handler.
43
46
44
47
A more detailed description of the termination behavior can be found in
45
48
[Termination of Pods](/docs/concepts/workloads/pods/pod-lifecycle/#pod-termination).
@@ -65,19 +68,15 @@ the Container ENTRYPOINT and hook fire asynchronously.
65
68
However, if the hook takes too long to run or hangs,
66
69
the Container cannot reach a `running` state.
67
70
68
-
`PreStop` hooks are not executed asynchronously from the signal
69
-
to stop the Container; the hook must complete its execution before
70
-
the signal can be sent.
71
-
If a `PreStop` hook hangs during execution,
72
-
the Pod's phase will be `Terminating` and remain there until the Pod is
73
-
killed after its `terminationGracePeriodSeconds` expires.
74
-
This grace period applies to the total time it takes for both
75
-
the `PreStop` hook to execute and for the Container to stop normally.
76
-
If, for example, `terminationGracePeriodSeconds` is 60, and the hook
77
-
takes 55 seconds to complete, and the Container takes 10 seconds to stop
78
-
normally after receiving the signal, then the Container will be killed
79
-
before it can stop normally, since `terminationGracePeriodSeconds` is
80
-
less than the total time (55+10) it takes for these two things to happen.
71
+
`PreStop` hooks are not executed asynchronously from the signal to stop the Container; the hook must
72
+
complete its execution before the TERM signal can be sent. If a `PreStop` hook hangs during
73
+
execution, the Pod's phase will be `Terminating` and remain there until the Pod is killed after its
74
+
`terminationGracePeriodSeconds` expires. This grace period applies to the total time it takes for
75
+
both the `PreStop` hook to execute and for the Container to stop normally. If, for example,
76
+
`terminationGracePeriodSeconds` is 60, and the hook takes 55 seconds to complete, and the Container
77
+
takes 10 seconds to stop normally after receiving the signal, then the Container will be killed
78
+
before it can stop normally, since `terminationGracePeriodSeconds` is less than the total time
0 commit comments