Updated on 2023-07-20 GMT+08:00

Rolling Upgrade

You are advised to use ServiceStage to deploy Spring Cloud applications, which facilitates rolling upgrade.

When using ServiceStage to deploy applications, you can configure the liveness probe and service probe of a component by referring to Configuring Health Check to check the Liveness and Ready statuses of microservices.

Spring Boot provides out-of-the-box container probes, LivenessStateHealthIndicator, and ReadinessStateHealthIndicator.

To configure a probe, you need to enable the spring-cloud-starter-huawei-actuator function.

<dependency>
  <groupId>com.huaweicloud</groupId>
  <artifactId>spring-cloud-starter-huawei-actuator</artifactId>
</dependency>

By default, LivenessStateHealthIndicator and ReadinessStateHealthIndicator do not contain any other health check items. Spring Cloud Huawei provides health check. When a service is registered successfully, true is returned. This check can be included in ReadinessStateHealthIndicator:

management.endpoint.health.group.readiness.include=registry

Then, set the service probe of the component as Table 1. After configuration and the service is successfully registered, ServiceStage displays the service ready status. During the rolling upgrade, the old instance is stopped only after the instance is successfully registered.

Table 1 Component service probes

Parameter

Mandatory

Description

Path

Yes

Request URL, for example, /actuator/health/readiness.

Port

Yes

Microservice port.

Latency (s)

No

Detection start time. For microservices that take a long time to start, you can prolong the time.

Timeout Period (s)

No

After the detection starts, if the probe status is not detected within the period specified by this parameter, the detection fails.

This module is provided only in Spring Cloud Huawei 1.9.0-Hoxton, 1.9.0-2020.0.x, and later versions.

In addition to setting probes, you need to set the rolling upgrade policy. The core parameters include the Max. Unavailable Pods. The default values of these two parameters are both 0. If there is only one instance, the rolling upgrade will be interrupted. You are advised to set 0 ≤ Max. Unavailable Pods.