Application Probes
For more information on each probe type, please see probe fundamentals.
For all probe settings see the reference documentation.
Below is an example that utilzed both readiness and liveness probes.
name: popcorn-controller
version: "1.0"
services:
- name: popcorn-controller-service
containers:
- name: kettle-popper-manager
image: "registry.gitlab.com/avassa-public/movie-theaters-demo/kettle-popper-manager:v1.0"
probes:
readiness:
exec:
cmd:
- /readiness_probe.sh
# Start probing immediately after startup
initial-delay: 0s
# Probe every 10 seconds
period: 10s
# Success after first successful probe
success-threshold: 1
# Requre 3 consecutive failures before marking container as non-ready
failure-threshold: 3
liveness:
http:
port: 10000
path: /live
# Start probing immediately after startup
initial-delay: 0s
# Probe every 10 seconds
period: 10s
# Success after first successful probe
success-threshold: 1
# Requre 3 consecutive failures before restarting container
failure-threshold: 3
mode: replicated
replicas: 1
Example readiness probe
In the readiness probe we run a script in the container. In the example above it's a simple shell script, but this can be any executable in the container, e.g.
probes:
readiness:
exec:
cmd:
- python3
- /readiness_probe.py
If the command exits with 0
it's considered success, and other exit code is considered a probe failure.
In shell scripts you can control the exit code with
#!/bin/sh
# Success
exit 0
# Failure
exit 1
And in Python
import sys
# Success
sys.exit(0)
# Failure
sys.exit(1)
Example liveness probe
In the liveness probe we instead use a HTTP probe. In this simple example, the Edge Enforcer will
do a HTTP GET to http://<application IP>:10000/live
.
<application IP>
above is known by the Edge Enforcer when the application runs.
If a HTTP probe returns with HTTP status codes 2xx
or 3xx
, it's considered a success, otherwise a failure.
On the HTTP probes, you can also pass query parameters in the path, e.g.
path: /live?foo=bar