6.4. Adding health checks using the Developer perspective

You can use the Topology view to add health checks to your deployed application.

Prerequisites:

  • You have switched to the Developer perspective in the web console.
  • You have created and deployed an application on OpenShift Container Platform using the Developer perspective.

Procedure

  1. In the Topology view, click on the application node to see the side panel. If the container does not have health checks added to ensure the smooth running of your application, a Health Checks notification is displayed with a link to add health checks.
  2. In the displayed notification, click the Add Health Checks link.
  3. Alternatively, you can also click the Actions drop-down list and select Add Health Checks. Note that if the container already has health checks, you will see the Edit Health Checks option instead of the add option.
  4. In the Add Health Checks form, if you have deployed multiple containers, use the Container drop-down list to ensure that the appropriate container is selected.
  5. Click the required health probe links to add them to the container. Default data for the health checks is prepopulated. You can add the probes with the default data or further customize the values and then add them. For example, to add a Readiness probe that checks if your container is ready to handle requests:

    1. Click Add Readiness Probe, to see a form containing the parameters for the probe.
    2. Click the Type drop-down list to select the request type you want to add. For example, in this case, select Container Command to select the command that will be executed inside the container.
    3. In the Command field, add an argument cat, similarly, you can add multiple arguments for the check, for example, add another argument /tmp/healthy.
    4. Retain or modify the default values for the other parameters as required.

      注意

      The Timeout value must be lower than the Period value. The Timeout default value is 1. The Period default value is 10.

    5. Click the check mark at the bottom of the form. The Readiness Probe Added message is displayed.
  6. Click Add to add the health check. You are redirected to the Topology view and the container is restarted.
  7. In the side panel, verify that the probes have been added by clicking on the deployed Pod under the Pods section.
  8. In the Pod Details page, click the listed container in the Containers section.
  9. In the Container Details page, verify that the Readiness probe - Exec Command cat /tmp/healthy has been added to the container.