Setting Health Check Parameters
Container health can be checked regularly when the container is running.
CCI provides two health check methods based on Kubernetes:
- Liveness probe: checks whether a containerized application is alive. The liveness probe is similar to the ps command for checking whether a process is running. If the containerized application fails the check, the container will be restarted. If the containerized application passes the check, no operation will be performed.
- Readiness probe: checks whether a containerized application is ready to handle requests. An application may take a long time to start up and provide services, for example, because it needs to load disk data or wait for the startup of an external module. In this case, application processes are running, but the application is not ready to provide services. This is where the readiness probe is useful.
Health Check Modes
- HTTP Request Mode
The probe sends an HTTP GET request to the container. If the probe receives a 2xx or 3xx status code, the container is healthy.
- Command Line Script
The probe runs a command in the container and checks the exit status code. If the exit status code is 0, the probe is healthy.
For example, if you want to run the cat /tmp/healthy command to check whether the /tmp/healthy directory exists, configure data as shown in the following figure.
Figure 1 Command setting
Common Parameter Description
Parameter |
Description |
---|---|
Time Window (s) |
Delay time (unit: second). For example, if you set this parameter to 10, the probe starts 10 seconds after the container is started. |
Timeout Period (s) |
Timeout period (unit: second). For example, if you set this parameter to 10, the container must return a response in 10 seconds. Otherwise, the probe is counted as failed. If you set this parameter to 0 or do not specify any value, the default value (1 second) is used. |
Setting Health Check Using kubectl
- For details about how to set the liveness probe, see Liveness Probe.
- For details about how to set the readiness probe, see Readiness Probe.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot