Guestbook Application: Liveness Probe
In this exercise we will add an liveness probe to the Guestbook application.
What you will learn:
- Create a Liveness Probe
1. Extend the guestbook application with a liveness probe
Use your existing definition as blueprint for your deployment of the guestbook app and modify it accordingly. (Or use 10 - Livenessprobe/5-example-app-cm-deploy.yaml)
The probe has the following requirements:
- The type is a http request
- The port is 8080
- The path is /list
- We want to wait 5 seconds before the first probe is run
- We want to check the service every 5 seconds
- The service is allowed to have two consecutive failed tests
- There no additional headers that need to be set
Solution
$ kubectl create -f "Kubernetes Labs/10 - Livenessprobe/5-example-app-cm-deploy.yaml"
Bonus: 2. Set a wrong port
Now we want see what happens when the probe fails: Set the port to 8081 instead of 8080. Notice the behavior of the pod/scheduler.