spring-boot-admin
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
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
The same, all it's ok if using server.port (which mean DO NOT set management.port itself), any feedback?
+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}
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
Closed due to inactivity. Feel free to reopen if issue still exists.