弹簧执行器更换主机

Fon*_*exn 0 spring openshift spring-boot kubernetes spring-boot-actuator

我正在尝试使用 Spring Boot 管理服务器设置 Spring Actuator。在我的本地机器上工作正常,但在 openshift 云中我遇到了一些问题......

当地的

d.c.b.a.c.r.ApplicationRegistrator       : Application registered itself as {id=93a4432e, name=orbe, managementUrl=http://localhost:8080/orbe, healthUrl=http://localhost:8080/orbe/status, serviceUrl=http://localhost:8080/orbe, statusInfo={}}}, source=http-api, metadata={}, info={}}
Run Code Online (Sandbox Code Playgroud)

d.c.b.a.c.r.ApplicationRegistrator       : Application registered itself as {id=7068c1d1, name=orbe, managementUrl=http://orbe-api-334-ciunv:8080/orbe, healthUrl=http://orbe-api-334-ciunv:8080/orbe/status, serviceUrl=http://orbe-api-334-ciunv:8080/orbe, statusInfo={status=UNKNOWN, timestamp=1496071160897, details={}}, source=http-api, metadata={}, info={}}
Run Code Online (Sandbox Code Playgroud)

在本地,应用程序具有正确的主机 (localhost),但在云中 Openshift (Kubernetes) 主机名是 POD 名称容器,并且无法正常工作(Spring Boot Admin 未检测到该应用程序,并且运行状况检查返回 UNKNOWN。

请问有人可以帮助我吗?谢谢!

Fon*_*exn 6

我找到了解决方案,覆盖 application.yml 中的 management-url:

spring:
  boot:
    admin:
      client:
        management-url: http://remote-docker-host:8080 #docker host
Run Code Online (Sandbox Code Playgroud)

更新 Spring Boot 2.0:

spring:
  boot:
    admin:
      client:
        url: http://spring-boot-admin-server-url:8080
        instance:
          service-url: http://you-application-url:8080
Run Code Online (Sandbox Code Playgroud)