question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect port used on Kubernetes

See original GitHub issue

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?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:18 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
drmaciejcommented, Aug 1, 2021

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.

0reactions
mvhiller2001commented, Nov 3, 2021

This worked like a charm, thank you so much.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Kubernetes is creating a nodeport service with incorrect port ...
The selector did not match any endpoint. I modified it and now the describe service command shows this: N
Read more >
kubectl expose apparently exposes wrong port / connections ...
I have a pod file that looks like this: apiVersion: v1 kind: Pod metadata: name: test-api labels: app: web spec: containers: - name: ......
Read more >
Ports and Protocols - Kubernetes
Although etcd ports are included in control plane section, you can also host your own etcd cluster externally or on custom ports. Worker...
Read more >
The connection to the server localhost:8080 was refused
kubectl cluster-info Kubernetes master is running at http://localhost:8080 To further debug and diagnose cluster problems, use 'kubectl ...
Read more >
Use Port Forwarding to Access Applications in a Cluster
This page shows how to use kubectl port-forward to connect to a MongoDB server running in a Kubernetes cluster. This type of connection...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found