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: articles/spring-apps/how-to-configure-health-probes-graceful-termination.md
+72-73Lines changed: 72 additions & 73 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ Azure Spring Apps offers default health probe rules for every application. This
29
29
30
30
-*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).
31
31
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.
33
33
34
34
## Prerequisites
35
35
@@ -90,13 +90,13 @@ There are three ways you can check an app instance using a probe. Each probe mus
90
90
91
91
#### [Azure portal](#tab/azure-portal)
92
92
93
-
Use the following steps to customize your application using Azure portal:
93
+
Use the following steps to customize your application using Azure portal.
94
94
95
95
1. Under **Settings**, select **Apps**, and then select the application from the list.
96
96
97
97
:::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.":::
98
98
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.
100
100
101
101
:::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.":::
102
102
@@ -106,14 +106,14 @@ Use the following steps to customize your application using Azure portal:
106
106
107
107
#### [Azure CLI](#tab/azure-cli)
108
108
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.
110
110
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:
1. Optionally, disable any specific health probe using the following command:
171
+
1. Optionally, use the following command to disable a health probe:
173
172
174
173
```azurecli
175
174
az spring app update \
176
175
--resource-group <resource-group-name> \
177
-
--service <Azure-Spring-Cloud-instance-name> \
176
+
--service <service-instance-name> \
178
177
--name <application-name> \
179
178
--enable-liveness-probe false
180
179
```
181
180
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:
183
182
184
183
```azurecli
185
184
az spring app update \
186
185
--resource-group <resource-group-name> \
187
-
--service <Azure-Spring-Cloud-instance-name> \
186
+
--service <service-instance-name> \
188
187
--name <application-name> \
189
188
--grace-period <termination-grace-period-seconds>
190
189
```
191
190
192
-
## Use best practices
191
+
## Best practices
193
192
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:
195
194
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).
199
196
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.
201
198
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.
203
200
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:
218
202
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
+
```
220
217
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
+
```
235
234
236
-
## FAQs
235
+
## Frequently asked questions
237
236
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.
239
238
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?
241
240
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.*
243
242
244
-
- What's the default probe settings for existing application?
243
+
- What's the default probe settings for and existing application?
245
244
246
245
*The following example shows the default settings:*
0 commit comments