microsoft / mindaro

Bridge to Kubernetes - for Visual Studio and Visual Studio Code
MIT License
307 stars 106 forks source link

Connecting issue #207

Closed mistake84 closed 3 years ago

mistake84 commented 3 years ago

We recently migrated to a private aks cluster. We only run into the problem now that we changed the pod port from 80 to 5002 and the service is running at 80 atm Finally, I tried to connect with the previous configuration and that is that the service and pod are both running on port 80 and then BTK works, but that would rather not be the setup we want to run now.

my apologies that I may not be explaining it completely clearly, but that has to do with the fact that I am still fairly new in terms of kubernetes. So my suspicion is that I have done a misconfiguration that is causing it to not work.

I did try to collect as many logs as possible. See below:

Visual studio code console: image

I attached the logs aswell.

bridge-library bridge-library-2021-07-20-13-30-27-22696.txt endpointmanager bridge-endpointmanager-2021-07-20-13-30-33-24232.txt mindarocli bridge-mindarocli-2021-07-20-13-30-26-22696.txt kubectl get pods -n -o=yaml pod.txt kubectl get svc -n -o yaml svc.txt

I hope you can help me further If you need any further information please let me know. thank you in advance

amsoedal commented 3 years ago

Hi @mistake84, thanks for reaching out to us! I have a couple of pointers:

1) Is traffic flowing successfully with the new configuration when you are not using Bridge? That is, when you hit the service, can you confirm that the traffic is getting routed to the container correctly (via logs perhaps)?

2) The port in the Bridge configuration should be whichever port your code is listening on. For our "frontend" sample app, the server listens on port 3000, so that is the port we use. Let me know if that makes sense!

image

mistake84 commented 3 years ago

Hi @amsoedal,

Thank you for the quick response.

  1. I can confirm that the application is running when i am not using the bridge. What kind of logs would you like to see from when its working? pod logs?

This are the pod logs i have from when the bridge is enabled:

warn: Microsoft.AspNetCore.Server.Kestrel[0]
      Overriding address(es) 'http://*:50051/'. Binding to endpoints defined in UseKestrel() instead.
  1. Thank you for the explanation that then that could not be the issue.
amsoedal commented 3 years ago

@mistake84 it really depends on your application, but if you are able to see that any requests going to the service endpoint get correctly sent to the pod, then your configuration is correct. (You could maybe try adding more log statements in your code to see when important endpoints get hit?) I want to make sure that the configuration is correct before we add Bridge into the equation.

If you confirm that everything is working correctly without Bridge, and that it fails with Bridge, then please attach the most recent Bridge logs one more time. It's important that the logs correspond to the most recent session. Thank you!

mistake84 commented 3 years ago

@amsoedal I can confirm that the application is running correctly when not using the bridge.

bridge-library-2021-07-21-09-07-01-29996.txt bridge-mindarocli-2021-07-21-09-07-00-29996.txt

bridge-endpointmanager-2021-07-21-09-07-08-24672.txt

If you have any question please let me know.

amsoedal commented 3 years ago

@mistake84 OK thanks for the response! Would it be possible for you to also attach the two tasks.json (the one that works, the one that doesn't)? Also, when you say the old configuration works, are you using the same manifest for the pod in both cases?

amsoedal commented 3 years ago

If it's easier, feel free to email them at BridgeToKubernetes@microsoft.com

mistake84 commented 3 years ago

During lunch I was talking to a colleague who is developer of the program and his suspicion is that there may be something in the code that is causing it. something about kestrel.

If I disable kestrel and re-deploy the service the bridge seems to work correctly.

I will get back to you tomorrow at the end of the day. Thanks for your help.

I will keep you posted

mistake84 commented 3 years ago

HI @amsoedal,

We got it to resolved by disabling Kestrel. Thanks for your help and have a nice weekend.

amsoedal commented 3 years ago

@mistake84, just out of curiosity: is there anywhere in your code that you're overriding the port to use? Most dotnet apps run on port 5000. I'm just looking at the logs you mention here:

warn: Microsoft.AspNetCore.Server.Kestrel[0] Overriding address(es) 'http://*:50051/'. Binding to endpoints defined in UseKestrel() instead.

I think it would be worth trying whichever port is defined in UseKestrel() when configuring Bridge. The port should always be whichever one the application listens on, not necessarily the one in the pod spec.