Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Health Check in Scale Up

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to use Health Check in Scale Up, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

Using Health Check in Scale Up

For multi-copy applications, when performing the Scale Up operation, the new copy will be added to the responsible balance of the Service as a backend to process the customer's request together with the existing copy. Considering that application startup usually requires a preparation phase, such as loading cached data, connecting to the database, etc., it takes a period of time from container startup to being able to provide services. We can use the Readiness probe to determine whether the container is ready to avoid sending the request to a backend that does not yet have a ready.

The following is the configuration file for the sample application.

Focus on the readinessProbe part. Here we use another detection method different from exec-httpGet. The condition for Kubernetes to determine the success of this method is that the return code of the http request is between 200,400.

Schema specifies the protocol and supports HTTP (default) and HTTPS.

Path specifies the access path.

Port specifies the port.

The purpose of the above configuration is:

The probe begins 10 seconds after the container starts.

If the http://[container_ip]:8080/healthy return code is not 200-400, the container is not ready and does not receive requests from Service web-svc.

Detect it again every five seconds.

Until the return code is 200-400, indicating that the container is ready, and then adding it to the responsible balance of web-svc to start processing customer requests.

The probe will continue to be executed at an interval of 5 seconds. If three consecutive failures occur, the container will be removed from the load balancer until the next probe is successfully rejoined.

For http://[container_ip]:8080/healthy, the application can implement its own judgment logic, such as checking whether the dependent database is ready. The sample code is as follows:

① defines the handler for / healthy.

② connects to the database and executes the test SQL.

③ test successful, normal return, code 200.

The ④ test failed with error code 503.

⑤ listens on port 8080.

It is recommended to configure Health Check for important applications in the production environment to ensure that the containers that handle customer requests are ready Service backend.

The above is the application of Health Check in Scale Up.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report