spring-boot-admin: Incorrect port used on Kubernetes

In k8s, it looks like management.port (as mentioned in https://codecentric.github.io/spring-boot-admin/current/#_converting_serviceinstances) is not used. I’m explicitly registering an instance of KubernetesServiceInstanceConverter, but it doesn’t seem to do the trick.

On my application “details” page I can see that port.management is set to 9999. I can also see that the Pod’s IP is correct and the port next to it is correct as well. The call to the health endpoint is made using 9999. Every other call is made using port 80.

I can see that links in responses from /actuator do not contain the port name, they look like http://my-app/actuator/env, and I suspect this is the endpoint that is used (including the implicit port 80), and management.port is not used.

Is there a way I can force boot-admin to always make all the requests on the right port?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 19 (4 by maintainers)

Most upvoted comments

I actually tried with both and experienced the same problem with both.

I ended up suppressing the EndpointDetector with a reduced one, so that endpoints are not discovered or parsed, but provided via properties:

    @Primary
    @Bean
    public EndpointDetector endpointDetector(InstanceRepository instanceRepository, InstanceWebClient.Builder instanceWebClientBuilder) {
        InstanceWebClient instanceWebClient = instanceWebClientBuilder.build();
        ProbeEndpointsStrategy strategy = new ProbeEndpointsStrategy(instanceWebClient, adminServer.getProbedEndpoints());
        return new EndpointDetector(instanceRepository, strategy);
    }

This finally resulted in the right port being used.