Updated on 2024-07-01 GMT+08:00

Configuring Health Check

Health check helps you check whether application instances and services are running.

This section describes health check by checking whether an application is interrupted during upgrade.

Precautions

  • When only the liveliness probe is used, if the network fluctuates or the program starts slowly, the instance will keep restarting and remains in the Not ready state.
    The following solutions are available:
    • Use startup probe together.
    • Increase Failure Threshold to increase the fault tolerance rate and increase Latency to ensure that the program accepts the liveliness probe detection after startup.
  • If status code 200 is returned, the check is successful.
  • If a status code other than 200 is returned and the number of consecutive failures reaches Failure Threshold, the check fails.

Procedure

  1. Log in to CAE.
  2. Choose Component Configurations.
  3. Select the target component from the drop-down list in the upper part of the page.

    Figure 1 Selecting a component

  4. Click Edit in the Health Check module.
  5. You can select liveliness probe, readiness probe, or startup probe. Different probes can be enabled at the same time.

    • Liveliness probe checks the startup health of application instances. The application instances are being started. Click next to Liveliness Probe to configure the check method.
    • Readiness probe checks the startup health of application instances. The application instances are available to provide services. Click next to Readiness Probe to configure the check method. In this example, the readiness probe must be enabled.
    • Startup probe checks the running health of application instances. If application instances are unhealthy, CAE restarts them. Click next to Startup Probe to configure the check method.
      Figure 2 Readiness probe

  6. Select a check method and set parameters. For details, see Table 1 and Table 2.

    Table 1 Check method parameters

    Check Method

    Parameter

    Description

    HTTP

    Port

    Port used to establish an HTTP GET connection.

    Path

    Path used to establish an HTTP GET connection.

    Protocol

    Select HTTP or HTTPS.

    Header

    HTTP header in the request.

    TCP

    Port

    Port for TCP connections. In this example, select TCP.

    Command

    Command

    Add a command. Click Add Command to add more commands.

    NOTE:

    No space is allowed after the command line.

    Table 2 Common parameters of the three check methods

    Parameter

    Description

    Check Interval

    Detection interval, in seconds.

    Default value: 10. Minimum value: 1. In this example, use the default value.

    Latency

    Maximum latency, in seconds.

    Default value: 0. Minimum value: 0. In this example, use the default value.

    NOTE:

    If you configure health check before starting the container, set Latency to 3 minutes.

    Timeout Interval

    Detection timeout interval, in seconds.

    Default value: 1. Minimum value: 1. In this example, use the default value.

    Success Threshold

    Health check is passed after a specified number of consecutive successful detections.

    Default value: 1. Minimum value: 1. For liveliness and startup probes, set it to 1. In this example, use the default value.

    Failure Threshold

    Health check fails after a specified number of consecutive failed detections.

    Default value: 3. Minimum value: 1. In this example, use the default value.

  7. Click OK.
  8. Make the configurations take effect.

    • If the component has been deployed, click Activate Settings in the upper part of the page. In the dialog box displayed on the right, confirm the configurations and click OK for the configurations to take effect.
    • If the component has not been deployed, click Set and Deploy Component in the upper part of the page. In the dialog box displayed on the right, click OK. After the deployment is complete, the configurations take effect.

  9. After upgrading the component, choose Component Events. If the Component instance healthy event is Normal, the component is successfully upgraded.

    Figure 3 Component health check