弹簧执行器更换主机

时间:2017-05-29 19:01:53

标签: spring spring-boot openshift 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={}}

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={}}

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

拜托,有人可以帮帮我吗?谢谢!

1 个答案:

答案 0 :(得分:4)

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

spring:
  boot:
    admin:
      client:
        management-url: http://remote-docker-host:8080 #docker host

更新Spring boot 2.0:

spring:
  boot:
    admin:
      client:
        url: http://spring-boot-admin-server-url:8080
        instance:
          service-url: http://you-application-url:8080