The health checks are really important because of it is used by OpenShift be able to know if it has something wrong with the application then terminate the pod and create a new one for example. It is possible to create two kinds of health checks. In a simple way, we can say that the type
liveness is more used to check if the application is alive and the
readiness is more to check if is possible read data from the application, for example by checking the HTTP code result of valid endpoints of this app.
You can use the
$oc set probe` command to create the health checks via the command line. Following an example to set an exec action as a liveness probe to run ‘echo ok’.
$oc set probe dc/blue --liveness -- echo ok`
Also, it can be created/added/edited/removed by editions on the deploy config object of the pod via the command
$oc edit dc/<name>` as the following example.
$oc edit dc/myapp
Following an example to set a readiness check.
$ oc set probe dc/gren --readiness --get-url=http://:8080/healthz --timeout-seconds=30
Following how it will be in the deploy config object.
It is important to let you know that both check healths can be added to the console/UI as the following example.
In the case of something goes wrong you can check in `Monitor Tab` and/or in the `Events Tab` of the pod application errors as follows.