spring-boot-admin icon indicating copy to clipboard operation
spring-boot-admin copied to clipboard

configure management.port when using consul fails for spring-boot 2.4.x /spring-cloud-consul 3.0.x with spring-boot-admin 2.4.0

Open lucwillems opened this issue 3 years ago • 4 comments

where in the process of upgrade our 20+ container from spring-boot 2.2.x to 2.4.5.

when working with the new 2.4.0 spring-boot-admin we noticed that the configure management.port is not correctly seen by spring-boot-admin, which causes the actuator url to be set to service port 8080

our containers which have actuator enabled have a metadata tag configuration management.port=9053 during upgrade of spring boot 2.4.x , cloud consul is also upgraded to 3.0.1 , which stores metadata in consul metadata en NOT in tags (old 2.x behaviour).

so mangement.port was moved to metadata , BUT , consul doens't allow this "management.port" key name and we get this error from consul (version : 1.9.5)

com.ecwid.consul.v1.OperationException: OperationException(statusCode=400, statusMessage='Bad Request', statusContent='Invalid Service Meta: Couldn't load metadata pair ('management.port', '9053'): Key contains invalid characters')

our ide recommends to use management-port.

using "old" spring boot admin 2.3 works because this is still based on old spring-cloud-consul which uses the tags to store metadata , see https://cloud.spring.io/spring-cloud-static/spring-cloud-consul/2.2.2.RELEASE/reference/html/#metadata-and-consul-tags which as a workaround until consul supported full metadata.

the newer cloud-consul , now uses this full metadata support but consul doesn't allow management.port as metadata key.

so in this case management.port should be changed to management-port , other "dotted" properties will have simuler issues

lucwillems avatar Jun 07 '21 09:06 lucwillems

The same, all it's ok if using server.port (which mean DO NOT set management.port itself), any feedback?

maistrovyi avatar Aug 20 '21 22:08 maistrovyi

+1

i use spring-boot 2.4.6 + servlert + consul

client config

management: server: port: 9000 endpoints: web: exposure: include: "*"

server: port: 80 http2: enabled: true servlet: encoding: force: true

spring: cloud: consul: host: ${consul.host:localhost} port: ${consul.port:8500} discovery: prefer-ip-address: true health-check-interval: 1m instance-zone: ${consul.discovery.instance-zone:hfhk} instance-group: ${consul.discovery.instance-group:hfhk} tags: ~ metadata: management-port: ${management.server.port}

微信截图_20211124143244 image

lijiajia3515 avatar Nov 24 '21 06:11 lijiajia3515

image

lijiajia3515 avatar Nov 24 '21 06:11 lijiajia3515

Hi,

we have found related issues containing workarounds:

  • #1351
  • #1456
  • #1932

Also, we now have understood the issue and will work on a solution.

Best, Stephan

SteKoe avatar Jan 07 '22 08:01 SteKoe

Closed due to inactivity. Feel free to reopen if issue still exists.

SteKoe avatar May 26 '23 07:05 SteKoe