microsoft / mindaro

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

output indicates port is already in use - when it is not. #339

Open williamohara opened 2 years ago

williamohara commented 2 years ago

Describe the bug getting this output that indicates port is in use I checked using netstat and I do not see it being used I am using wsl I checked bot wsl and windows os the port is not being used

not sure if this is a bug - but I just don't know where to go with it - any pointers on how to configure?

Waiting for 'tenant-auth-ui-64c4465bbd-6v4dk' in namespace 'default' to reach running state...
Deployment 'default/tenant-auth-ui' patched to run agent.
Remote agent deployed in container 'tenant-auth-ui' in pod 'tenant-auth-ui-64c4465bbd-6v4dk'.
Preparing to run Bridge To Kubernetes configured as pod default/tenant-auth-ui-64c4465bbd-6v4dk ...
Connection established.
Service 'subscripify-core-ingress-nginx-controller-admission' is available on 127.0.0.1:55049.
Service 'subscripify-core-ingress-nginx-controller' is available on 127.0.0.1:55050.
Service 'subscripify-core-ingress-nginx-controller' is available on 127.0.0.1:55051.
Service 'main-tenant-kratos-admin' is available on 127.0.0.1:55052.
Service 'tenant-auth-ui' is available on 127.0.0.1:55053.
Service 'kubernetes' is available on 127.0.0.1:55054.
Service 'main-tenant-kratos-public' is available on 127.0.0.1:55055.
Service 'main-tenant-kratos-courier-0.main-tenant-kratos-courier' is available on 127.0.0.1:55056.
Port 55056 is already in use on your machine. Please free this port and try again. Use 'netstat -ano' command to find which program is using this port.
Stopping workload and cleaning up...
Restore: Deployment 'tenant-auth-ui' restored to original state with image 'subscripifycontreg.azurecr.io/tenant-auth-ui:latest'.
Failed to establish a connection. Error: Port 55056 is already in use on your machine. Please free this port and try again. Use 'netstat -ano' command to find which program is using this port.

here is my task.json

{
    "version": "2.0.0",
    "tasks": [
    {
      "label": "bridge-to-kubernetes.resource",
      "type": "bridge-to-kubernetes.resource",
      "resource": "tenant-auth-ui",
      "resourceType": "service",
      "ports": [
        3000
      ],
      "targetCluster": "core-cluster",
      "targetNamespace": "default",
      "useKubernetesServiceEnvironmentVariables": true
    }
  ]
}

here is my launch configuration

{
  "version": "0.2.0",
    "configurations": [
      {
        "type": "node-terminal",
        "name": "Run Script: dev with Kubernetes",
        "request": "launch",
        "command": "npm run dev",
        "cwd": "${workspaceFolder}",
        "preLaunchTask": "bridge-to-kubernetes.resource",
        "env": {
          "GRPC_DNS_RESOLVER": "native"
        }
      }
...

To Reproduce not sure if you can unless you launch the exact same services i am

**Expected behavior** A clear and concise description of what you expected to happen. **Logs** ``` 2022-08-07T15:27:08.3985824Z | MindaroCli | TRACE | Event: Command.Start {"properties":{"arguments":"connect --service tenant-auth-ui --env /tmp/tmp-157387xc105yuvyug.env --script /tmp/tmp-157387xc105yuvyug.env.cmd --control-port 56163 --ppid 15378 --namespace default --use-kubernetes-service-environment-variables --local-port 3000","isRoutingEnabled":"false"},"metrics":null}\nOperation context: {"clientRequestId":null,"correlationId":"ab23040e-ac89-4b30-b525-b3a494f323ce1659883964582:c48f26119ac2","requestId":null,"userSubscriptionId":null,"startTime":"2022-08-07T15:27:08.2010526Z","userAgent":"VSCode/1.0.120220804","requestHttpMethod":null,"requestUri":null,"version":"1.0.20220804.3","requestHeaders":{},"loggingProperties":{"applicationName":"MindaroCli","deviceOperatingSystem":"Linux 4.19.128-microsoft-standard #1 SMP Tue Jun 23 12:58:10 UTC 2020","framework":".NET Core 3.1.9","macAddressHash":"d6b110c7b2044c65e3ba3b99efc41920cc0e8e1819042520724a16bce8d446aa","processId":18822,"targetEnvironment":"Production","commandId":"c48f26119ac2"}} 2022-08-07T15:27:08.4670025Z | MindaroCli | TRACE | Running Microsoft.BridgeToKubernetes.Exe.Commands.Connect.ConnectCommand...\nOperation context: {"clientRequestId":null,"correlationId":"ab23040e-ac89-4b30-b525-b3a494f323ce1659883964582:c48f26119ac2","requestId":null,"userSubscriptionId":null,"startTime":"2022-08-07T15:27:08.2010526Z","userAgent":"VSCode/1.0.120220804","requestHttpMethod":null,"requestUri":null,"version":"1.0.20220804.3","requestHeaders":{},"loggingProperties":{"applicationName":"MindaroCli","deviceOperatingSystem":"Linux 4.19.128-microsoft-standard #1 SMP Tue Jun 23 12:58:10 UTC 2020","framework":".NET Core 3.1.9","macAddressHash":"d6b110c7b2044c65e3ba3b99efc41920cc0e8e1819042520724a16bce8d446aa","processId":18822,"targetEnvironment":"Production","commandId":"c48f26119ac2","targetServiceName":"tenant-auth-ui","isRoutingEnabled":false}} 2022-08-07T15:27:16.5999679Z | MindaroCli | TRACE | Remoting started listening on 56163 2022-08-07T15:27:31.1797994Z | MindaroCli | TRACE | Connection established.\n 2022-08-07T15:27:31.2409853Z | MindaroCli | WARNG | Port 55056 is already in use on your machine. Please free this port and try again. Use 'netstat -ano' command to find which program is using this port. 2022-08-07T15:27:31.2413669Z | MindaroCli | ERROR | Port 55056 is already in use on your machine. Please free this port and try again. Use 'netstat -ano' command to find which program is using this port.\n 2022-08-07T15:27:31.2418625Z | MindaroCli | TRACE | Stopping workload and cleaning up...\n 2022-08-07T15:27:32.8754780Z | MindaroCli | TRACE | Event: Command.End {"properties":{"arguments":"connect --service tenant-auth-ui --env /tmp/tmp-157387xc105yuvyug.env --script /tmp/tmp-157387xc105yuvyug.env.cmd --control-port 56163 --ppid 15378 --namespace default --use-kubernetes-service-environment-variables --local-port 3000","result":"Failed","failureReason":"Port 55056 is already in use on your machine. Please free this port and try again. Use 'netstat -ano' command to find which program is using this port."},"metrics":{"duration":24539.0}} ``` **Environment Details** Client used (VS Code/Visual Studio): Vs Code ``` bencoleman.armview@0.4.6 hashicorp.terraform@2.23.0 mindaro-dev.file-downloader@1.0.12 mindaro.mindaro@1.0.120220804 ms-azure-devops.azure-pipelines@1.208.0 ms-azuretools.vscode-azureappservice@0.24.3 ms-azuretools.vscode-azurefunctions@1.7.4 ms-azuretools.vscode-azureresourcegroups@0.5.5 ms-azuretools.vscode-azurestaticwebapps@0.11.2 ms-azuretools.vscode-azurestorage@0.14.2 ms-azuretools.vscode-azureterraform@0.3.2 ms-azuretools.vscode-azurevirtualmachines@0.6.2 ms-azuretools.vscode-bicep@0.9.1 ms-azuretools.vscode-cosmosdb@0.19.2 ms-azuretools.vscode-docker@1.22.1 ms-dotnettools.vscode-dotnet-runtime@1.5.0 ms-kubernetes-tools.vscode-aks-tools@1.3.3 ms-kubernetes-tools.vscode-kubernetes-tools@1.3.10 ms-vscode.azure-account@0.11.1 ms-vscode.azurecli@0.5.0 ms-vscode.vscode-node-azure-pack@1.0.0 ms-vscode.vscode-typescript-next@4.8.20220806 msazurermtools.azurerm-vscode-tools@0.15.7 paulshen.paul-typescript-toolkit@0.0.6 Pivotal.vscode-spring-boot@1.37.0 redhat.fabric8-analytics@0.3.6 redhat.java@1.9.0 redhat.vscode-commons@0.0.6 redhat.vscode-yaml@1.9.1 sohibe.java-generate-setters-getters@7.4.0 streetsidesoftware.code-spell-checker@2.3.5 tomoki1207.pdf@1.2.0 VisualStudioExptTeam.vscodeintellicode@1.2.22 vscjava.vscode-java-debug@0.43.0 vscjava.vscode-java-dependency@0.21.0 vscjava.vscode-java-pack@0.25.0 vscjava.vscode-java-test@0.36.0 vscjava.vscode-maven@0.37.0 vscjava.vscode-spring-boot-dashboard@0.6.0 vscjava.vscode-spring-initializr@0.10.1 ``` Client's version: Operating System: Ubuntu 20.04 on WSL Windows 10 Pro Version 10.0.19044 Build 19044
williamohara commented 2 years ago

I have a workaround -

  1. remove the offending service (uninstall using helm)
  2. Launch bridge - it will connect successfully
  3. then redeploy, using helm, the offending services

everything seems to work - but it is a hassle

williamohara commented 2 years ago

Any help here would be appreciated - this is proving to be a big blocker for me