[OpenShift] – Health checks

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   

Screen Shot 2018-04-17 at 10.00.32

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. 

Screen Shot 2018-04-17 at 10.19.27

It is important to let you know that both check healths can be added to the console/UI as the following example.

Screen Shot 2018-04-17 at 11.22.10

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. Screen Shot 2018-04-17 at 11.23.46

Screen Shot 2018-04-17 at 11.24.00

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s