Add note on health-checks for Kubernetes and Swarm

Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
This commit is contained in:
Alex Ellis (VMware) 2018-08-21 14:57:14 +01:00
parent 8fe8120b36
commit 9a879c96c3

View File

@ -45,9 +45,17 @@ ENV fprocess="/bin/cat"
CMD ["fwatchdog"]
```
**Implementing a Docker healthcheck**
**Implementing a health-check**
A Docker Healthcheck is not required but is best practice. It will make sure that the watchdog is ready to accept a request before forwarding requests via the API Gateway. If the function or watchdog runs into an unrecoverable issue Swarm will also be able to restart the container.
At any point in time, if you detect that your function has become unhealthy and needs to restart, then you can delete the `/tmp/.lock` file which invalidates the check and causes Swarm to re-schedule the function.
* Kubernetes
For Kubernetes the health check is added through automation without you needing to alter the `Dockerfile`.
* Swarm
A Docker Swarm Healthcheck is required and is best practice. It will make sure that the watchdog is ready to accept a request before forwarding requests via the API Gateway. If the function or watchdog runs into an unrecoverable issue Swarm will also be able to restart the container.
Here is an example of the `echo` function implementing a healthcheck with a 5-second checking interval.