Skip to content

Commit 33fc929

Browse files
authored
Merge pull request #102880 from dlepow/acifresh1
[ACI Freshness] Liveness/readiness probes
2 parents c1d5266 + 91975d6 commit 33fc929

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

articles/container-instances/container-instances-liveness-probe.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Set up liveness probe on container instance
33
description: Learn how to configure liveness probes to restart unhealthy containers in Azure Container Instances
44
ms.topic: article
5-
ms.date: 06/08/2018
5+
ms.date: 01/30/2020
66
---
77
# Configure liveness probes
88

@@ -57,41 +57,41 @@ az container create --resource-group myResourceGroup --name livenesstest -f live
5757

5858
### Start command
5959

60-
The deployment defines a starting command to be run when the container first starts running, defined by the `command` property, which accepts an array of strings. In this example, it will start a bash session and create a file called `healthy` within the `/tmp` directory by passing this command:
60+
The deployment includes a `command` property defining a starting command that runs when the container first starts running. This property accepts an array of strings. This command simulates the container entering an unhealthy state.
61+
62+
First, it starts a bash session and creates a file called `healthy` within the `/tmp` directory. It then sleeps for 30 seconds before deleting the file, then enters a 10-minute sleep:
6163

6264
```bash
6365
/bin/sh -c "touch /tmp/healthy; sleep 30; rm -rf /tmp/healthy; sleep 600"
6466
```
6567

66-
It will then sleep for 30 seconds before deleting the file, then enters a 10-minute sleep.
67-
6868
### Liveness command
6969

70-
This deployment defines a `livenessProbe` that supports an `exec` liveness command that acts as the liveness check. If this command exits with a non-zero value, the container will be killed and restarted, signaling the `healthy` file could not be found. If this command exits successfully with exit code 0, no action will be taken.
70+
This deployment defines a `livenessProbe` that supports an `exec` liveness command that acts as the liveness check. If this command exits with a non-zero value, the container is killed and restarted, signaling the `healthy` file could not be found. If this command exits successfully with exit code 0, no action is taken.
7171

7272
The `periodSeconds` property designates the liveness command should execute every 5 seconds.
7373

7474
## Verify liveness output
7575

76-
Within the first 30 seconds, the `healthy` file created by the start command exists. When the liveness command checks for the `healthy` file's existence, the status code returns a zero, signaling success, so no restarting occurs.
76+
Within the first 30 seconds, the `healthy` file created by the start command exists. When the liveness command checks for the `healthy` file's existence, the status code returns 0, signaling success, so no restarting occurs.
7777

78-
After 30 seconds, the `cat /tmp/healthy` will begin to fail, causing unhealthy and killing events to occur.
78+
After 30 seconds, the `cat /tmp/healthy` command begins to fail, causing unhealthy and killing events to occur.
7979

8080
These events can be viewed from the Azure portal or Azure CLI.
8181

8282
![Portal unhealthy event][portal-unhealthy]
8383

84-
By viewing the events in the Azure portal, events of type `Unhealthy` will be triggered upon the liveness command failing. The subsequent event will be of type `Killing`, signifying a container deletion so a restart can begin. The restart count for the container increments each time this event occurs.
84+
By viewing the events in the Azure portal, events of type `Unhealthy` are triggered upon the liveness command failing. The subsequent event is of type `Killing`, signifying a container deletion so a restart can begin. The restart count for the container increments each time this event occurs.
8585

86-
Restarts are completed in-place so resources like public IP addresses and node-specific contents will be preserved.
86+
Restarts are completed in-place so resources like public IP addresses and node-specific contents are preserved.
8787

8888
![Portal restart counter][portal-restart]
8989

90-
If the liveness probe continuously fails and triggers too many restarts, your container will enter an exponential back off delay.
90+
If the liveness probe continuously fails and triggers too many restarts, your container enters an exponential back-off delay.
9191

9292
## Liveness probes and restart policies
9393

94-
Restart policies supersede the restart behavior triggered by liveness probes. For example, if you set a `restartPolicy = Never` *and* a liveness probe, the container group will not restart because of a failed liveness check. The container group will instead adhere to the container group's restart policy of `Never`.
94+
Restart policies supersede the restart behavior triggered by liveness probes. For example, if you set a `restartPolicy = Never` *and* a liveness probe, the container group will not restart because of a failed liveness check. The container group instead adheres to the container group's restart policy of `Never`.
9595

9696
## Next steps
9797

articles/container-instances/container-instances-readiness-probe.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Set up readiness probe on container instance
33
description: Learn how to configure a probe to ensure containers in Azure Container Instances receive requests only when they are ready
44
ms.topic: article
5-
ms.date: 10/17/2019
5+
ms.date: 01/30/2020
66
---
77

88
# Configure readiness probes
@@ -18,7 +18,7 @@ Azure Container Instances also supports [liveness probes](container-instances-li
1818
1919
## YAML configuration
2020

21-
As an example, create a `readiness-probe.yaml` file with the following snippet that includes a readiness probe. This file defines a container group that consists of a container running a small web app. The app is deployed from the public `mcr.microsoft.com/azuredocs/aci-helloworld` image. This container app is also demonstrated in quickstarts such as [Deploy a container instance in Azure using the Azure CLI](container-instances-quickstart.md).
21+
As an example, create a `readiness-probe.yaml` file with the following snippet that includes a readiness probe. This file defines a container group that consists of a container running a small web app. The app is deployed from the public `mcr.microsoft.com/azuredocs/aci-helloworld` image. This containerized app is also demonstrated in [Deploy a container instance in Azure using the Azure CLI](container-instances-quickstart.md) and other quickstarts.
2222

2323
```yaml
2424
apiVersion: 2018-10-01
@@ -58,7 +58,9 @@ type: Microsoft.ContainerInstance/containerGroups
5858
5959
### Start command
6060
61-
The YAML file includes a starting command to be run when the container starts, defined by the `command` property that accepts an array of strings. This command simulates a time when the web app runs but the container isn't ready. First, it starts a shell session and runs a `node` command to start the web app. It also starts a command to sleep for 240 seconds, after which it creates a file called `ready` within the `/tmp` directory:
61+
The deployment includes a `command` property defining a starting command that runs when the container first starts running. This property accepts an array of strings. This command simulates a time when the web app runs but the container isn't ready.
62+
63+
First, it starts a shell session and runs a `node` command to start the web app. It also starts a command to sleep for 240 seconds, after which it creates a file called `ready` within the `/tmp` directory:
6264

6365
```console
6466
node /usr/src/app/index.js & (sleep 240; touch /tmp/ready); wait

0 commit comments

Comments
 (0)