Skip to content

Commit dcd4b7c

Browse files
committed
Merge branch '3.3.x' into 3.4.x
Closes gh-44022
2 parents e01a23b + 7f9b4c6 commit dcd4b7c

File tree

1 file changed

+18
-1
lines changed
  • spring-boot-project/spring-boot-docs/src/docs/antora/modules/how-to/pages/deployment

1 file changed

+18
-1
lines changed

spring-boot-project/spring-boot-docs/src/docs/antora/modules/how-to/pages/deployment/cloud.adoc

+18-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,22 @@ Because this shutdown processing happens in parallel (and due to the nature of d
124124

125125
You can configure a sleep execution in a preStop handler to avoid requests being routed to a pod that has already begun shutting down.
126126
This sleep should be long enough for new requests to stop being routed to the pod and its duration will vary from deployment to deployment.
127-
The preStop handler can be configured by using the PodSpec in the pod's configuration file as follows:
127+
128+
If you're using Kubernetes 1.32 or up, the preStop handler can be configured by using the PodSpec in the pod's configuration file as follows:
129+
130+
[source,yaml]
131+
----
132+
spec:
133+
containers:
134+
- name: "example-container"
135+
image: "example-image"
136+
lifecycle:
137+
preStop:
138+
sleep:
139+
seconds: 10
140+
----
141+
142+
If you're not on Kubernetes 1.32 yet, you can use an `exec` command to invoke `sleep`.
128143

129144
[source,yaml]
130145
----
@@ -138,6 +153,8 @@ spec:
138153
command: ["sh", "-c", "sleep 10"]
139154
----
140155

156+
NOTE: The container needs to have a shell for this to work.
157+
141158
Once the pre-stop hook has completed, SIGTERM will be sent to the container and xref:reference:web/graceful-shutdown.adoc[graceful shutdown] will begin, allowing any remaining in-flight requests to complete.
142159

143160
NOTE: When Kubernetes sends a SIGTERM signal to the pod, it waits for a specified time called the termination grace period (the default for which is 30 seconds).

0 commit comments

Comments
 (0)