Skip to content

Commit df23aed

Browse files
edit pass done
1 parent b71d000 commit df23aed

File tree

1 file changed

+72
-73
lines changed

1 file changed

+72
-73
lines changed

articles/spring-apps/how-to-configure-health-probes-graceful-termination.md

Lines changed: 72 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Azure Spring Apps offers default health probe rules for every application. This
2929

3030
- *Readiness probes* determine when an app instance is ready to start accepting traffic. For example, readiness probes can control which app instances are used as backends for the application. When an app instance isn't ready, it's removed from Kubernetes service discovery. For more information, see [Discover and register your Spring Boot applications](how-to-service-registration.md).
3131

32-
- *Startup probes* determine when an application has started. A startup probe disables liveness and readiness checks until startup succeeds, ensuring that liveness and readiness probes don't interfere with application startup. You can use use startup probes to perform liveness checks on slow starting applications, preventing the app from terminating before it's up and running.
32+
- *Startup probes* determine when an application has started. A startup probe disables liveness and readiness checks until startup succeeds, ensuring that liveness and readiness probes don't interfere with application startup. You can use startup probes to perform liveness checks on slow starting applications, preventing the app from terminating before it's up and running.
3333

3434
## Prerequisites
3535

@@ -90,13 +90,13 @@ There are three ways you can check an app instance using a probe. Each probe mus
9090

9191
#### [Azure portal](#tab/azure-portal)
9292

93-
Use the following steps to customize your application using Azure portal:
93+
Use the following steps to customize your application using Azure portal.
9494

9595
1. Under **Settings**, select **Apps**, and then select the application from the list.
9696

9797
:::image type="content" source="media/how-to-configure-health-probes-graceful-termination/select-app.jpg" lightbox="media/how-to-configure-health-probes-graceful-termination/select-app.jpg" alt-text="Screenshot of Azure portal showing the Apps page.":::
9898

99-
1. Select **Configuration** in the left naviation pane, select **Health probes**, and then specify Health proble properties.
99+
1. Select **Configuration** in the left navigation pane, select **Health probes**, and then specify Health probe properties.
100100

101101
:::image type="content" source="media/how-to-configure-health-probes-graceful-termination/probe-config.jpg" lightbox="media/how-to-configure-health-probes-graceful-termination/probe-config.jpg" alt-text="Screenshot of the Azure portal Configuration page showing the Health probes tab.":::
102102

@@ -106,14 +106,14 @@ Use the following steps to customize your application using Azure portal:
106106

107107
#### [Azure CLI](#tab/azure-cli)
108108

109-
Use the following steps show you how to customize your application using Azure CLI.
109+
Use the following steps to customize your application using Azure CLI.
110110

111-
1. Use the following command to create an application with liveness probe and readiness probe:
111+
1. Use the following command to create an application with a liveness probe and readiness probe:
112112

113113
```azurecli
114114
az spring app create \
115115
--resource-group <resource-group-name> \
116-
--service <Azure-Spring-Cloud-instance-name> \
116+
--service <service-instance-name> \
117117
--name <application-name> \
118118
--enable-liveness-probe true \
119119
--liveness-probe-config <path-to-liveness-probe-json-file> \
@@ -138,110 +138,109 @@ Use the following steps show you how to customize your application using Azure C
138138
}
139139
```
140140

141-
> [!NOTE]
142-
> Azure Spring Apps also support two more kinds of probe actions, as shown in the following JSON file examples:
143-
>
144-
> ```json
145-
> "probeAction": {
146-
> "type": "HTTPGetAction",
147-
> "scheme": "HTTP",
148-
> "path": "/anyPath"
149-
> }
150-
> ```
151-
>
152-
> and
153-
>
154-
> ```json
155-
> "probeAction": {
156-
> "type": "ExecAction",
157-
> "command": ["cat", "/tmp/healthy"]
158-
> }
159-
> ```
160-
161-
1. Optionally, protect slow starting containers with a startup probe by using the following command:
141+
The following example shows an `HTTPGetAction` action:
142+
143+
```json
144+
"probeAction": {
145+
"type": "HTTPGetAction",
146+
"scheme": "HTTP",
147+
"path": "/anyPath"
148+
}
149+
```
150+
151+
The following example shows an ``ExecAction` action:
152+
153+
```json
154+
"probeAction": {
155+
"type": "ExecAction",
156+
"command": ["cat", "/tmp/healthy"]
157+
}
158+
```
159+
160+
1. Optionally, use the following command to protect slow starting containers with a startup probe:
162161

163162
```azurecli
164163
az spring app update \
165164
--resource-group <resource-group-name> \
166-
--service <Azure-Spring-Cloud-instance-name> \
165+
--service <service-instance-name> \
167166
--name <application-name> \
168167
--enable-startup-probe true \
169168
--startup-probe-config <path-to-startup-probe-json-file>
170169
```
171170

172-
1. Optionally, disable any specific health probe using the following command:
171+
1. Optionally, use the following command to disable a health probe:
173172

174173
```azurecli
175174
az spring app update \
176175
--resource-group <resource-group-name> \
177-
--service <Azure-Spring-Cloud-instance-name> \
176+
--service <service-instance-name> \
178177
--name <application-name> \
179178
--enable-liveness-probe false
180179
```
181180

182-
1. Optionally, set the termination grace period seconds using the following command:
181+
1. Optionally, use the following command to set the termination grace period:
183182

184183
```azurecli
185184
az spring app update \
186185
--resource-group <resource-group-name> \
187-
--service <Azure-Spring-Cloud-instance-name> \
186+
--service <service-instance-name> \
188187
--name <application-name> \
189188
--grace-period <termination-grace-period-seconds>
190189
```
191190

192-
## Use best practices
191+
## Best practices
193192

194-
Use the following best practices when adding your own persistent storage to Azure Spring Apps.
193+
Use the following best practices when adding your own persistent storage to Azure Spring Apps:
195194

196-
- Use liveness and readiness probe together. The reason for this recommendation is that Azure Spring Apps provides two approaches for service discovery at the same time. When the readiness probe fails, the app instance will be removed only from Kubernetes Service Discovery. A properly configured liveness probe can remove the issued app instance from Eureka Service Discovery to avoid unexpected cases. For more information about Service Discovery, see [Discover and register your Spring Boot applications](how-to-service-registration.md).
197-
- When an app instance starts, the first check is done after the delay specified by `initialDelaySeconds`, and subsequent checks happen periodically, with the period length specified by `periodSeconds`. If the app has failed to respond to the requests for several times as specified by `failureThreshold`, the app instance will be restarted. Be sure your application can start fast enough, or update these parameters, so the total timeout `initialDelaySeconds + periodSeconds * failureThreshold` is longer than the start time of your application.
198-
- For Spring Boot applications, Spring Boot shipped with the [Health Groups](https://docs.spring.io/spring-boot/docs/2.2.x/reference/html/production-ready-features.html#health-groups) support, allowing developers to select a subset of health indicators and group them under a single, correlated, health status. For more information, see [Liveness and Readiness Probes with Spring Boot](https://spring.io/blog/2020/03/25/liveness-and-readiness-probes-with-spring-boot) on the Spring Blog.
195+
- Use liveness and readiness probes together. Azure Spring Apps provides two approaches for service discovery at the same time. When the readiness probe fails, the app instance is removed only from Kubernetes service discovery. A properly configured liveness probe can remove the issued app instance from Eureka service discovery to avoid unexpected cases. For more information about service discovery, see [Discover and register your Spring Boot applications](how-to-service-registration.md).
199196

200-
The following examples show Liveness and Readiness probes with Spring Boot:
197+
- When an app instance starts, the first check occurs after the delay specified by `initialDelaySeconds`. Subsequent checks occur periodically, according to the period length specified by `periodSeconds`. If the app fails to respond to the requests for several times as specified by `failureThreshold`, the app instance is restarted. Make sure your application can start fast enough, or update these parameters, so that the total timeout `initialDelaySeconds + periodSeconds * failureThreshold` is longer than the start time of your application.
201198

202-
- Liveness probe:
199+
- For Spring Boot applications, Spring Boot shipped with the [Health Groups](https://docs.spring.io/spring-boot/docs/2.2.x/reference/html/production-ready-features.html#health-groups) support, allowing developers to select a subset of health indicators and group them under a single, correlated health status. For more information, see [Liveness and Readiness Probes with Spring Boot](https://spring.io/blog/2020/03/25/liveness-and-readiness-probes-with-spring-boot) on the Spring Blog.
203200

204-
```json
205-
"probe": {
206-
"initialDelaySeconds": 30,
207-
"periodSeconds": 10,
208-
"timeoutSeconds": 1,
209-
"failureThreshold": 30,
210-
"successThreshold": 1,
211-
"probeAction": {
212-
"type": "HTTPGetAction",
213-
"scheme": "HTTP",
214-
"path": "/actuator/health/liveness"
215-
}
216-
}
217-
```
201+
The following example shows a liveness probe with Spring Boot:
218202

219-
- Readiness probe:
203+
```json
204+
"probe": {
205+
"initialDelaySeconds": 30,
206+
"periodSeconds": 10,
207+
"timeoutSeconds": 1,
208+
"failureThreshold": 30,
209+
"successThreshold": 1,
210+
"probeAction": {
211+
"type": "HTTPGetAction",
212+
"scheme": "HTTP",
213+
"path": "/actuator/health/liveness"
214+
}
215+
}
216+
```
220217

221-
```json
222-
"probe": {
223-
"initialDelaySeconds": 0,
224-
"periodSeconds": 10,
225-
"timeoutSeconds": 1,
226-
"failureThreshold": 3,
227-
"successThreshold": 1,
228-
"probeAction": {
229-
"type": "HTTPGetAction",
230-
"scheme": "HTTP",
231-
"path": "/actuator/health/readiness"
232-
}
233-
}
234-
```
218+
The following example shows a readiness probe with Spring Boot:
219+
220+
```json
221+
"probe": {
222+
"initialDelaySeconds": 0,
223+
"periodSeconds": 10,
224+
"timeoutSeconds": 1,
225+
"failureThreshold": 3,
226+
"successThreshold": 1,
227+
"probeAction": {
228+
"type": "HTTPGetAction",
229+
"scheme": "HTTP",
230+
"path": "/actuator/health/readiness"
231+
}
232+
}
233+
```
235234

236-
## FAQs
235+
## Frequently asked questions
237236

238-
The following list shows frequently asked questions (FAQ) about using health probes with Azure Spring Apps.
237+
This section provides answers to frequently asked questions about using health probes with Azure Spring Apps.
239238

240-
- I received 400 response when I created applications with customized health probes. What does this mean?
239+
- I received a 400 response when I created applications with customized health probes. What does this mean?
241240

242-
*The error message will point out which probe is responsible for the provision failure. Be sure the health probe rules are correct and the timeout is long enough for the application to be in the running state.*
241+
*The error message will point out which probe is responsible for the provision failure. Make sure that the health probe rules are correct and that the timeout is long enough for the application to be in the running state.*
243242

244-
- What's the default probe settings for existing application?
243+
- What's the default probe settings for and existing application?
245244

246245
*The following example shows the default settings:*
247246

0 commit comments

Comments
 (0)