其他分享
首页 > 其他分享> > k8s微服务平滑上下线改造步骤

k8s微服务平滑上下线改造步骤

作者:互联网

1.网关拦截掉/actuator相关接口

2.服务pom加上jar包

  <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
  </dependency>

3.健康接口使用/actuator/health

4.application.properties添加配置
management.endpoints.web.exposure.include=*
management.endpoint.shutdown.enabled=true
management.endpoint.health.show-details=always

5.k8s加上preStop执行命令
curl -X POST localhost:[端口]/actuator/shutdown

标签:management,步骤,平滑,boot,health,shutdown,actuator,k8s
来源: https://www.cnblogs.com/tnessn/p/offline_gracefully.html