Skip to content

Commit f6fb9df

Browse files
author
Robert McNees
committed
Remove instructions for adding prestop in k8s
Addressing GH issue 8. The prestop command is not required. As of Spring Boot 3.4 the build-image command will not include a shell that will also fail on deployment.
1 parent cf14c43 commit f6fb9df

File tree

4 files changed

+5
-19
lines changed

4 files changed

+5
-19
lines changed

README.adoc

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,12 @@ Before moving on be sure to stop the `port-forward` command above.
212212
The solution to this section is defined in `k8s-artifacts/best_practice/*`.
213213

214214
Our application runs on Kubernetes, but, in order for our application to run optimally, we recommend implementing
215-
several best practices:
215+
the best practices:
216216

217217
1. https://docs.spring.io/spring-boot/reference/actuator/endpoints.html#actuator.endpoints.kubernetes-probes[+++Add readiness and liveness probes+++]
218-
2. https://docs.spring.io/spring-boot/how-to/deployment/cloud.html#howto.deployment.cloud.kubernetes.container-lifecycle[+++Wait for container lifecycle processes to finish+++]
219-
3. https://docs.spring.io/spring-boot/reference/web/graceful-shutdown.html#web.graceful-shutdown[+++Enable graceful shutdown+++]
218+
2. https://docs.spring.io/spring-boot/reference/web/graceful-shutdown.html#web.graceful-shutdown[+++Enable graceful shutdown+++]
220219

221-
Open `deployment.yaml` in a text editor and add the readiness, liveness, and lifecycle properties to your file:
220+
Open `deployment.yaml` in a text editor and add the readiness, and liveness properties to your file:
222221

223222
.k8s/deployment.yaml
224223
[source,yaml]
@@ -227,9 +226,8 @@ include::k8s-artifacts/best_practice/deployment.yaml[]
227226
228227
----
229228

230-
This takes care of best practices 1 and 2.
231-
232-
To address the third best practice, we need to add a property to our application configuration. Since we run our
229+
This will address the first best practice.
230+
Additionally, we need to add a property to our application configuration. Since we run our
233231
application on Kubernetes, we can take advantage of https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/[+++Kubernetes ConfigMaps+++]
234232
to externalize this property, as a good cloud developer should. We now take a look at how to do that.
235233

k8s-artifacts/best_practice/deployment.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,5 @@ spec:
3030
httpGet:
3131
path: /actuator/health/readiness
3232
port: 8080
33-
lifecycle:
34-
preStop:
35-
exec:
36-
command: [ "sh", "-c", "sleep 10" ]
3733
status: {}
3834

k8s-artifacts/config_map/deployment.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ spec:
3030
httpGet:
3131
path: /actuator/health/readiness
3232
port: 8080
33-
lifecycle:
34-
preStop:
35-
exec:
36-
command: [ "sh", "-c", "sleep 10" ]
3733
volumeMounts:
3834
- name: config-volume
3935
mountPath: /workspace/config

k8s-artifacts/service_discovery/deployment.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ spec:
3030
httpGet:
3131
path: /actuator/health/readiness
3232
port: 8080
33-
lifecycle:
34-
preStop:
35-
exec:
36-
command: [ "sh", "-c", "sleep 10" ]
3733
volumeMounts:
3834
- name: config-volume
3935
mountPath: /workspace/config

0 commit comments

Comments
 (0)