microsoft / mindaro

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

VS Code, Bridge to Kubernetes: Failed to establish a connection. Error: Connect operation failed #127

Open manojsaxenatda opened 3 years ago

manojsaxenatda commented 3 years ago

Describe the bug Failed to establish a connection. Error: Connect operation failed.

To Reproduce I have Linux (RHEL7) dev machine and I connect to this Linux dev box from my Windows10 desktop using “Remote SSH” feature offered by VS Code. I have a three node Kubernetes cluster. I use Kubectl/helm from my Linux dev box to push new code to K8 cluster.

The micro services are hosted in one k8 namespace and each microservice has just one replica pod. There is a nginx ingress controller for cluster, and an ingress rule for each service to route traffic based on Virtual Host to a specific service in given namespace.

This setup is working great for us and I am now trying to setup “Bridge to Kubernetes” so that I can develop/debug microservices efficiently running in a k8 cluster. I have followed the instructions on setting up https://code.visualstudio.com/docs/containers/bridge-to-kubernetes. Kubernetes extension is able to see K8 cluster, namespace, services, pods, …

But when I try to use VS Code to launch my service with Kubernetes, I get the following VS Code pop up error:

"Failed to establish a connection. Error: Connect operation failed. Oops... An unexpected error has occurred. For diagnostic information, see logs at '/tmp/Bridge To Kubernetes'"

**Expected behavior** As described in B2K documentation, I expect tunnel to be established between my dev machine and K8 and inbound traffic to microservice, that I am trying to debug, should flow to my dev machine. **Logs** I have checked K8 logs but don’t see any failures, Attach logs from /tmp/B2K directory: **Bridge-mindarocli.txt** ``` 2021-03-03T22:30:51.1453272Z | MindaroCli | TRACE | Event: Command.Start {"properties":{"arguments":"connect --service halo-appinv --env /tmp/tmp-16155gyefh7npynwq.env --script /tmp/tmp-16155gyefh7npynwq.env.cmd --control-port 52949 --ppid 100275 --use-kubernetes-service-environment-variables --local-port 32238","isRoutingEnabled":"false"},"metrics":null}\nOperation context: {"clientRequestId":null,"correlationId":"d9724948-659d-4423-9451-f9ede2953f901614809348887:eec4c37cb8df","requestId":null,"userSubscriptionId":null,"startTime":"2021-03-03T22:30:50.6876394Z","userAgent":"VSCode/1.0.120210224","requestHttpMethod":null,"requestUri":null,"version":"1.0.20210224.1","requestHeaders":{},"loggingProperties":{"applicationName":"MindaroCli","deviceOperatingSystem":"Linux 3.10.0-1160.15.2.el7.x86_64 #1 SMP Thu Jan 21 16:15:07 EST 2021","framework":".NET Core 3.1.9","macAddressHash":"43105d4c86f3e0d77f310085f5dd00e9c2aba52e9fb2e6f2b3be75dc5fa15960","processId":21730,"targetEnvironment":"Production","commandId":"eec4c37cb8df"}} 2021-03-03T22:30:51.2581030Z | MindaroCli | TRACE | Running Microsoft.BridgeToKubernetes.Exe.Commands.Connect.ConnectCommand...\nOperation context: {"clientRequestId":null,"correlationId":"d9724948-659d-4423-9451-f9ede2953f901614809348887:eec4c37cb8df","requestId":null,"userSubscriptionId":null,"startTime":"2021-03-03T22:30:50.6876394Z","userAgent":"VSCode/1.0.120210224","requestHttpMethod":null,"requestUri":null,"version":"1.0.20210224.1","requestHeaders":{},"loggingProperties":{"applicationName":"MindaroCli","deviceOperatingSystem":"Linux 3.10.0-1160.15.2.el7.x86_64 #1 SMP Thu Jan 21 16:15:07 EST 2021","framework":".NET Core 3.1.9","macAddressHash":"43105d4c86f3e0d77f310085f5dd00e9c2aba52e9fb2e6f2b3be75dc5fa15960","processId":21730,"targetEnvironment":"Production","commandId":"eec4c37cb8df","targetServiceName":"halo-appinv","isRoutingEnabled":false}} 2021-03-03T22:30:51.2696311Z | MindaroCli | TRACE | Initializing progress reporter... 2021-03-03T22:30:52.0332706Z | MindaroCli | TRACE | Remoting started listening on 52949 2021-03-03T22:30:52.7769140Z | MindaroCli | ERROR | Dependency: Service Run - Port Forward {"target":null,"success":false,"duration":null,"properties":{"requestId":"null","clientRequestId":"null","correlationRequestId":"null"}} 2021-03-03T22:30:52.7819200Z | MindaroCli | ERROR | ServiceConnectCommand.ExecuteInnerAsync caught exception System.NullReferenceException: Object reference not set to an instance of an object.\n at Microsoft.BridgeToKubernetes.Library.Models.RemoteContainerConnectionDetails.UpdateSourceEntityTypeToDeployment(V1Deployment deployment)\n at Microsoft.BridgeToKubernetes.Library.Utilities.RemoteContainerConnectionDetailsResolver.ResolveConnectionDetails(RemoteContainerConnectionDetails remoteContainerConnectionDetails, CancellationToken cancellationToken)\n at Microsoft.BridgeToKubernetes.Library.ManagementClients.ConnectManagementClient.<>c__DisplayClass13_0.<<-ctor>b__0>d.MoveNext()\n--- End of stack trace from previous location where exception was thrown ---\n at Microsoft.BridgeToKubernetes.Library.ManagementClients.ConnectManagementClient.<>c__DisplayClass16_0.<b__0>d.MoveNext()\n--- End of stack trace from previous location where exception was thrown ---\n at Microsoft.BridgeToKubernetes.Library.ManagementClients.ManagementClientExceptionStrategy.RunWithHandlingAsync[T](Func`1 func, FailureConfig failureConfig)\n at Microsoft.BridgeToKubernetes.Library.ManagementClients.ConnectManagementClient.StartRemoteAgentAsync(IProgress`1 progress, CancellationToken cancellationToken)\n at Microsoft.BridgeToKubernetes.Exe.Commands.Connect.ConnectCommand.ExecuteInnerAsync(IConnectManagementClient connectManagementClient, Action`1 workloadStartedHandler, CancellationToken cancellationToken, IRoutingManagementClient routingManagementClient) 2021-03-03T22:30:52.7843996Z | MindaroCli | **ERROR** | Connect operation failed.\n 2021-03-03T22:30:52.7867269Z | MindaroCli | TRACE | Stopping workload and cleaning up...\n 2021-03-03T22:30:52.8051344Z | MindaroCli | ERROR | Dependency: Service Run - Port Forward {"target":null,"success":false,"duration":null,"properties":{"requestId":"null","clientRequestId":"null","correlationRequestId":"null"}} 2021-03-03T22:30:53.0682250Z | MindaroCli | ERROR | Oops... An unexpected error has occurred.\n 2021-03-03T22:30:53.0693522Z | MindaroCli | ERROR | For diagnostic information, see logs at '/tmp/Bridge To Kubernetes'.\n 2021-03-03T22:30:53.0731108Z | MindaroCli | ERROR | Logging handled exception: System.NullReferenceException: {"ClassName":"System.NullReferenceException","Message":"Object reference not set to an instance of an object.","Data":null,"InnerException":null,"HelpURL":null,"StackTraceString":" at Microsoft.BridgeToKubernetes.Library.Models.RemoteContainerConnectionDetails.UpdateSourceEntityTypeToDeployment(V1Deployment deployment)\n at Microsoft.BridgeToKubernetes.Library.Utilities.RemoteContainerConnectionDetailsResolver.ResolveConnectionDetails(RemoteContainerConnectionDetails remoteContainerConnectionDetails, CancellationToken cancellationToken)\n at Microsoft.BridgeToKubernetes.Library.ManagementClients.ConnectManagementClient.<>c__DisplayClass13_0.<<-ctor>b__0>d.MoveNext()\n--- End of stack trace from previous location where exception was thrown ---\n at Microsoft.BridgeToKubernetes.Library.ManagementClients.ConnectManagementClient.<>c__DisplayClass16_0.<b__0>d.MoveNext()\n--- End of stack trace from previous location where exception was thrown ---\n at Microsoft.BridgeToKubernetes.Library.ManagementClients.ManagementClientExceptionStrategy.RunWithHandlingAsync[T](Func`1 func, FailureConfig failureConfig)\n at Microsoft.BridgeToKubernetes.Library.ManagementClients.ConnectManagementClient.StartRemoteAgentAsync(IProgress`1 progress, CancellationToken cancellationToken)\n at Microsoft.BridgeToKubernetes.Exe.Commands.Connect.ConnectCommand.ExecuteInnerAsync(IConnectManagementClient connectManagementClient, Action`1 workloadStartedHandler, CancellationToken cancellationToken, IRoutingManagementClient routingManagementClient)\n at Microsoft.BridgeToKubernetes.Exe.Commands.Connect.ConnectCommand.ExecuteInnerAsync(IConnectManagementClient connectManagementClient, Action`1 workloadStartedHandler, CancellationToken cancellationToken, IRoutingManagementClient routingManagementClient)\n at Microsoft.BridgeToKubernetes.Exe.Commands.Connect.ConnectCommand.ExecuteAsync()\n at Microsoft.BridgeToKubernetes.Exe.CliApp.RunCommandAsync(String[] args, CancellationToken cancellationToken)\n at Microsoft.BridgeToKubernetes.Exe.CliApp.ExecuteAsync(String[] args, CancellationToken cancellationToken)","RemoteStackTraceString":null,"RemoteStackIndex":0,"ExceptionMethod":null,"HResult":-2147467261,"Source":"Microsoft.BridgeToKubernetes.Library","WatsonBuckets":null} 2021-03-03T22:30:53.0746638Z | MindaroCli | TRACE | Event: Command.End {"properties":{"arguments":"connect --service halo-appinv --env /tmp/tmp-16155gyefh7npynwq.env --script /tmp/tmp-16155gyefh7npynwq.env.cmd --control-port 52949 --ppid 100275 --use-kubernetes-service-environment-variables --local-port 32238","result":"Failed","failureReason":"Object reference not set to an instance of an object."},"metrics":{"duration":2015.0}} ``` **Bridge-library.txt** ``` 2021-03-03T22:30:51.2980808Z | Library | TRACE | Pulling kubeconfig...\nOperation context: {"clientRequestId":null,"correlationId":"d9724948-659d-4423-9451-f9ede2953f901614809348887:eec4c37cb8df:a89a0890ebb3","requestId":null,"userSubscriptionId":null,"startTime":"2021-03-03T22:30:51.2092663Z","userAgent":"VSCode/1.0.120210224","requestHttpMethod":null,"requestUri":null,"version":"1.0.20210224.1","requestHeaders":{},"loggingProperties":{"applicationName":"Library","deviceOperatingSystem":"Linux 3.10.0-1160.15.2.el7.x86_64 #1 SMP Thu Jan 21 16:15:07 EST 2021","framework":".NET Core 3.1.9","macAddressHash":"43105d4c86f3e0d77f310085f5dd00e9c2aba52e9fb2e6f2b3be75dc5fa15960","processId":21730,"targetEnvironment":"Production"}} 2021-03-03T22:30:51.4146366Z | Library | TRACE | Event: CloudProvider {"properties":{"clusterFQDNDomain":"Remote IP"},"metrics":null} 2021-03-03T22:30:52.5276004Z | Library | TRACE | Dependency: Kubernetes {"target":"GetV1ServiceAsync","success":true,"duration":null,"properties":{}} 2021-03-03T22:30:52.6527420Z | Library | TRACE | Dependency: Kubernetes {"target":"ListPodsInNamespaceAsync","success":true,"duration":null,"properties":{}} 2021-03-03T22:30:52.6892482Z | Library | TRACE | Event: KubernetesRemoteEnvironmentManager-GetPodsFromService {"properties":{"result":"Succeeded"},"metrics":{"durationInMs":120.0}}\nOperation context: {"clientRequestId":null,"correlationId":"d9724948-659d-4423-9451-f9ede2953f901614809348887:eec4c37cb8df:74c5996492ef","requestId":null,"userSubscriptionId":null,"startTime":"2021-03-03T22:30:51.2092663Z","userAgent":"VSCode/1.0.120210224","requestHttpMethod":null,"requestUri":null,"version":"1.0.20210224.1","requestHeaders":{},"loggingProperties":{"applicationName":"Library","deviceOperatingSystem":"Linux 3.10.0-1160.15.2.el7.x86_64 #1 SMP Thu Jan 21 16:15:07 EST 2021","framework":".NET Core 3.1.9","macAddressHash":"43105d4c86f3e0d77f310085f5dd00e9c2aba52e9fb2e6f2b3be75dc5fa15960","processId":21730,"targetEnvironment":"Production","isRoutingEnabled":false}} 2021-03-03T22:30:52.7003374Z | Library | TRACE | Successfully got container from service and pod. 2021-03-03T22:30:52.7093223Z | Library | TRACE | Event: ConnectManagementClient-StartRemoteAgent {"properties":{"result":"Failed"},"metrics":{"durationInMs":598.0}} 2021-03-03T22:30:52.7106099Z | Library | ERROR | Failed to start remote agent. 2021-03-03T22:30:52.7633226Z | Library | ERROR | Logging handled exception: System.NullReferenceException: {"ClassName":"System.NullReferenceException","Message":"Object reference not set to an instance of an object.","Data":null,"InnerException":null,"HelpURL":null,"StackTraceString":" at Microsoft.BridgeToKubernetes.Library.Models.RemoteContainerConnectionDetails.UpdateSourceEntityTypeToDeployment(V1Deployment deployment)\n at Microsoft.BridgeToKubernetes.Library.Utilities.RemoteContainerConnectionDetailsResolver.ResolveConnectionDetails(RemoteContainerConnectionDetails remoteContainerConnectionDetails, CancellationToken cancellationToken)\n at Microsoft.BridgeToKubernetes.Library.ManagementClients.ConnectManagementClient.<>c__DisplayClass13_0.<<-ctor>b__0>d.MoveNext()\n--- End of stack trace from previous location where exception was thrown ---\n at Microsoft.BridgeToKubernetes.Library.ManagementClients.ConnectManagementClient.<>c__DisplayClass16_0.<b__0>d.MoveNext()\n--- End of stack trace from previous location where exception was thrown ---\n at Microsoft.BridgeToKubernetes.Library.ManagementClients.ManagementClientExceptionStrategy.RunWithHandlingAsync[T](Func`1 func, FailureConfig failureConfig)","RemoteStackTraceString":null,"RemoteStackIndex":0,"ExceptionMethod":null,"HResult":-2147467261,"Source":"Microsoft.BridgeToKubernetes.Library","WatsonBuckets":null} 2021-03-03T22:30:52.8005824Z | Library | TRACE | Event: KubernetesRemoteEnvironmentManager-Restore {"properties":{"result":"Succeeded"},"metrics":{"durationInMs":0.0}} 2021-03-03T22:30:52.8009046Z | Library | TRACE | Event: KubernetesRemoteEnvironmentManager-RestoreRemoteAgent {"properties":{"result":"Succeeded"},"metrics":{"durationInMs":9.0}} 2021-03-03T22:30:52.8010782Z | Library | TRACE | Event: ConnectManagementClient-RestoreOriginalRemoteContainer {"properties":{"result":"Succeeded"},"metrics":{"durationInMs":11.0}} 2021-03-03T22:30:52.8035502Z | Library | TRACE | Event: LocalEnvironmentManager-StopWorkload {"properties":{"result":"Succeeded"},"metrics":{"durationInMs":0.0}} 2021-03-03T22:30:52.8037315Z | Library | TRACE | Event: ConnectManagementClient-StopLocalConnection {"properties":{"result":"Succeeded"},"metrics":{"durationInMs":1.0}} ``` **Exthost.log** ``` [2021-03-03 16:10:09.582] [exthost] [info] extension host started [2021-03-03 16:10:10.146] [exthost] [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch {"startup":true,"extensionId":{"value":"vscode.debug-auto-launch","_lower":"vscode.debug-auto-launch"},"activationEvent":"*"} [2021-03-03 16:10:10.146] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/sax421/.vscode-server/bin/ea3859d4ba2f3e577a159bc91e3074c5d85c0523/extensions/debug-auto-launch/dist/extension [2021-03-03 16:10:10.161] [exthost] [info] ExtensionService#_doActivateExtension vscode.emmet {"startup":true,"extensionId":{"value":"vscode.emmet","_lower":"vscode.emmet"},"activationEvent":"*"} [2021-03-03 16:10:10.161] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/sax421/.vscode-server/bin/ea3859d4ba2f3e577a159bc91e3074c5d85c0523/extensions/emmet/dist/node/emmetNodeMain [2021-03-03 16:10:10.207] [exthost] [info] ExtensionService#_doActivateExtension vscode.git {"startup":true,"extensionId":{"value":"vscode.github","_lower":"vscode.github"},"activationEvent":"*"} [2021-03-03 16:10:10.207] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/sax421/.vscode-server/bin/ea3859d4ba2f3e577a159bc91e3074c5d85c0523/extensions/git/dist/main [2021-03-03 16:10:10.288] [exthost] [info] ExtensionService#_doActivateExtension vscode.merge-conflict {"startup":true,"extensionId":{"value":"vscode.merge-conflict","_lower":"vscode.merge-conflict"},"activationEvent":"*"} [2021-03-03 16:10:10.289] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/sax421/.vscode-server/bin/ea3859d4ba2f3e577a159bc91e3074c5d85c0523/extensions/merge-conflict/dist/mergeConflictMain [2021-03-03 16:10:10.302] [exthost] [info] ExtensionService#_doActivateExtension vscode.search-result {"startup":true,"extensionId":{"value":"vscode.search-result","_lower":"vscode.search-result"},"activationEvent":"*"} [2021-03-03 16:10:10.303] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/sax421/.vscode-server/bin/ea3859d4ba2f3e577a159bc91e3074c5d85c0523/extensions/search-result/dist/extension.js [2021-03-03 16:10:10.313] [exthost] [info] ExtensionService#_doActivateExtension dbaeumer.vscode-eslint {"startup":true,"extensionId":{"value":"dbaeumer.vscode-eslint","_lower":"dbaeumer.vscode-eslint"},"activationEvent":"*"} [2021-03-03 16:10:10.313] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/sax421/.vscode-server/extensions/dbaeumer.vscode-eslint-2.1.1/client/out/extension [2021-03-03 16:10:10.347] [exthost] [info] ExtensionService#_doActivateExtension eamodio.gitlens {"startup":true,"extensionId":{"value":"eamodio.gitlens","_lower":"eamodio.gitlens"},"activationEvent":"*"} [2021-03-03 16:10:10.347] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/sax421/.vscode-server/extensions/eamodio.gitlens-10.2.3/dist/extension [2021-03-03 16:10:10.459] [exthost] [info] ExtensionService#_doActivateExtension redhat.vscode-yaml {"startup":true,"extensionId":{"value":"mindaro.mindaro","_lower":"mindaro.mindaro"},"activationEvent":"*"} [2021-03-03 16:10:10.459] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/sax421/.vscode-server/extensions/redhat.vscode-yaml-0.15.0/out/src/extension [2021-03-03 16:10:10.854] [exthost] [info] ExtensionService#_doActivateExtension mindaro-dev.file-downloader {"startup":true,"extensionId":{"value":"mindaro.mindaro","_lower":"mindaro.mindaro"},"activationEvent":"*"} [2021-03-03 16:10:10.854] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/sax421/.vscode-server/extensions/mindaro-dev.file-downloader-1.0.10/dist/extension [2021-03-03 16:10:11.275] [exthost] [info] ExtensionService#_doActivateExtension ms-kubernetes-tools.vscode-kubernetes-tools {"startup":true,"extensionId":{"value":"mindaro.mindaro","_lower":"mindaro.mindaro"},"activationEvent":"*"} [2021-03-03 16:10:11.275] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/sax421/.vscode-server/extensions/ms-kubernetes-tools.vscode-kubernetes-tools-1.2.4/dist/extension [2021-03-03 16:10:11.766] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode.js-debug {"startup":false,"extensionId":{"value":"ms-vscode.js-debug","_lower":"ms-vscode.js-debug"},"activationEvent":"onCommand:extension.js-debug.clearAutoAttachVariables"} [2021-03-03 16:10:11.766] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/sax421/.vscode-server/bin/ea3859d4ba2f3e577a159bc91e3074c5d85c0523/extensions/ms-vscode.js-debug/src/extension.js [2021-03-03 16:10:12.073] [exthost] [info] ExtensionService#_doActivateExtension vscode.github {"startup":false,"extensionId":{"value":"vscode.github","_lower":"vscode.github"},"activationEvent":"*"} [2021-03-03 16:10:12.073] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/sax421/.vscode-server/bin/ea3859d4ba2f3e577a159bc91e3074c5d85c0523/extensions/github/dist/extension.js [2021-03-03 16:10:12.385] [exthost] [warning] [redhat.vscode-yaml] Accessing a resource scoped configuration without providing a resource is not expected. To get the effective value for '[yaml]', provide the URI of a resource or 'null' for any resource. [2021-03-03 16:10:12.549] [exthost] [info] ExtensionService#_doActivateExtension mindaro.mindaro {"startup":false,"extensionId":{"value":"mindaro.mindaro","_lower":"mindaro.mindaro"},"activationEvent":"*"} [2021-03-03 16:10:12.549] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/sax421/.vscode-server/extensions/mindaro.mindaro-1.0.120210224/dist/extension [2021-03-03 16:10:16.122] [exthost] [info] eager extensions activated [2021-03-03 16:10:50.502] [exthost] [info] ExtensionService#_doActivateExtension vscode.typescript-language-features {"startup":false,"extensionId":{"value":"vscode.typescript-language-features","_lower":"vscode.typescript-language-features"},"activationEvent":"onLanguage:javascript"} [2021-03-03 16:10:50.502] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/sax421/.vscode-server/bin/ea3859d4ba2f3e577a159bc91e3074c5d85c0523/extensions/typescript-language-features/dist/extension [2021-03-03 16:10:54.204] [exthost] [info] ExtensionService#_doActivateExtension vscode.configuration-editing {"startup":false,"extensionId":{"value":"vscode.configuration-editing","_lower":"vscode.configuration-editing"},"activationEvent":"onLanguage:jsonc"} [2021-03-03 16:10:54.204] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/sax421/.vscode-server/bin/ea3859d4ba2f3e577a159bc91e3074c5d85c0523/extensions/configuration-editing/dist/configurationEditingMain [2021-03-03 16:10:54.213] [exthost] [info] ExtensionService#_doActivateExtension vscode.json-language-features {"startup":false,"extensionId":{"value":"vscode.json-language-features","_lower":"vscode.json-language-features"},"activationEvent":"onLanguage:jsonc"} [2021-03-03 16:10:54.213] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/sax421/.vscode-server/bin/ea3859d4ba2f3e577a159bc91e3074c5d85c0523/extensions/json-language-features/client/dist/node/jsonClientMain [2021-03-03 16:12:21.264] [exthost] [info] ExtensionService#_doActivateExtension vscode.debug-server-ready {"startup":false,"extensionId":{"value":"vscode.debug-server-ready","_lower":"vscode.debug-server-ready"},"activationEvent":"onDebugResolve"} [2021-03-03 16:12:21.265] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/sax421/.vscode-server/bin/ea3859d4ba2f3e577a159bc91e3074c5d85c0523/extensions/debug-server-ready/dist/extension [2021-03-03 16:12:21.283] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode.node-debug2 {"startup":false,"extensionId":{"value":"ms-vscode.node-debug","_lower":"ms-vscode.node-debug"},"activationEvent":"onDebugResolve:node"} [2021-03-03 16:12:21.284] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/sax421/.vscode-server/bin/ea3859d4ba2f3e577a159bc91e3074c5d85c0523/extensions/ms-vscode.node-debug2/out/src/extension [2021-03-03 16:12:21.297] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode.node-debug {"startup":false,"extensionId":{"value":"ms-vscode.node-debug","_lower":"ms-vscode.node-debug"},"activationEvent":"onDebugResolve:node"} [2021-03-03 16:12:21.297] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/sax421/.vscode-server/bin/ea3859d4ba2f3e577a159bc91e3074c5d85c0523/extensions/ms-vscode.node-debug/dist/extension.js [2021-03-03 16:12:21.335] [exthost] [info] ExtensionService#_doActivateExtension vscode.grunt {"startup":false,"extensionId":{"value":"vscode.grunt","_lower":"vscode.grunt"},"activationEvent":"onCommand:workbench.action.tasks.runTask"} [2021-03-03 16:12:21.335] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/sax421/.vscode-server/bin/ea3859d4ba2f3e577a159bc91e3074c5d85c0523/extensions/grunt/dist/main [2021-03-03 16:12:21.343] [exthost] [info] ExtensionService#_doActivateExtension vscode.gulp {"startup":false,"extensionId":{"value":"vscode.gulp","_lower":"vscode.gulp"},"activationEvent":"onCommand:workbench.action.tasks.runTask"} [2021-03-03 16:12:21.343] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/sax421/.vscode-server/bin/ea3859d4ba2f3e577a159bc91e3074c5d85c0523/extensions/gulp/dist/main [2021-03-03 16:12:21.351] [exthost] [info] ExtensionService#_doActivateExtension vscode.jake {"startup":false,"extensionId":{"value":"vscode.jake","_lower":"vscode.jake"},"activationEvent":"onCommand:workbench.action.tasks.runTask"} [2021-03-03 16:12:21.351] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/sax421/.vscode-server/bin/ea3859d4ba2f3e577a159bc91e3074c5d85c0523/extensions/jake/dist/main [2021-03-03 16:12:21.358] [exthost] [info] ExtensionService#_doActivateExtension vscode.npm {"startup":false,"extensionId":{"value":"vscode.npm","_lower":"vscode.npm"},"activationEvent":"onCommand:workbench.action.tasks.runTask"} [2021-03-03 16:12:21.358] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/sax421/.vscode-server/bin/ea3859d4ba2f3e577a159bc91e3074c5d85c0523/extensions/npm/dist/npmMain [2021-03-03 16:12:21.397] [exthost] [info] ExtensionService#_doActivateExtension ms-azuretools.vscode-docker {"startup":false,"extensionId":{"value":"ms-azuretools.vscode-docker","_lower":"ms-azuretools.vscode-docker"},"activationEvent":"onCommand:workbench.action.tasks.runTask"} [2021-03-03 16:12:21.398] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/sax421/.vscode-server/extensions/ms-azuretools.vscode-docker-1.10.0/main [2021-03-03 16:12:22.506] [exthost] [info] ExtensionService#_doActivateExtension vscode.extension-editing {"startup":false,"extensionId":{"value":"vscode.extension-editing","_lower":"vscode.extension-editing"},"activationEvent":"onLanguage:json"} [2021-03-03 16:12:22.506] [exthost] [info] ExtensionService#loadCommonJSModule file:///home/sax421/.vscode-server/bin/ea3859d4ba2f3e577a159bc91e3074c5d85c0523/extensions/extension-editing/dist/extensionEditingMain ``` **Minadaro-vscode.txt** ``` 2021-03-04T14:40:10.213Z | Common Extension Root | TRACE | Event: binaries-utility-try-get-binaries-success 2021-03-04T14:40:10.214Z | Common Extension Root | TRACE | Event: connect-service-task-terminal-start-connect {"serviceName":"halo-appinv","ports":"32238"} 2021-03-04T14:40:10.216Z | Common Extension Root | TRACE | Event: kubectl-client-command {"args":"config view --minify -o json"} 2021-03-04T14:40:10.338Z | Common Extension Root | TRACE | Event: kubectl-client-command-success {"args":"config view --minify -o json"} 2021-03-04T14:40:10.341Z | Common Extension Root | TRACE | Event: binaries-utility-try-get-binaries-success 2021-03-04T14:40:10.342Z | Common Extension Root | TRACE | Event: binaries-utility-try-get-binaries-success 2021-03-04T14:40:10.343Z | Common Extension Root | TRACE | Event: kubectl-client-command {"args":"config view --minify -o json"} 2021-03-04T14:40:10.493Z | Common Extension Root | TRACE | Event: kubectl-client-command-success {"args":"config view --minify -o json"} 2021-03-04T14:40:10.494Z | Connect (halo/2645d121-1 | TRACE | Event: connect-start-connect {"service":"halo-appinv","ports":"32238","os":"linux"} 2021-03-04T14:40:13.731Z | Common Extension Root | ERROR | Error: cli-client-connect-error Error: Connect operation failed.\nOops... An unexpected error has occurred.\nFor diagnostic information, see logs at '/tmp/Bridge To Kubernetes'.\n\n at ChildProcess. (/home/sax421/.vscode-server/extensions/mindaro.mindaro-1.0.120210224/dist/extension.js:3:135852)\n at ChildProcess.emit (events.js:223:5)\n at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12) 2021-03-04T14:40:13.734Z | Connect (halo/2645d121-1 | ERROR | Error: connect-error Error: Connect operation failed.\nOops... An unexpected error has occurred.\nFor diagnostic information, see logs at '/tmp/Bridge To Kubernetes'.\n\n at ChildProcess. (/home/sax421/.vscode-server/extensions/mindaro.mindaro-1.0.120210224/dist/extension.js:3:135852)\n at ChildProcess.emit (events.js:223:5)\n at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12) 2021-03-04T14:40:13.738Z | Common Extension Root | ERROR | Error: connect-service-task-terminal-error Error: Failed to establish a connection. Error: Connect operation failed.\nOops... An unexpected error has occurred.\nFor diagnostic information, see logs at '/tmp/Bridge To Kubernetes'.\n\n at /home/sax421/.vscode-server/extensions/mindaro.mindaro-1.0.120210224/dist/extension.js:3:71685\n at runMicrotasks ()\n at processTicksAndRejections (internal/process/task_queues.js:94:5) ``` **Environment Details** **Client used (VS Code):** VS Code **Version: 1.52.1** Commit: ea3859d4ba2f3e577a159bc91e3074c5d85c0523 Date: 2020-12-16T16:34:46.910Z Electron: 9.3.5 Chrome: 83.0.4103.122 Node.js: 12.14.1 V8: 8.3.110.13-electron.0 OS: Windows_NT x64 10.0.17763 **Extensions:** dbaeumer.vscode-eslint-2.1.1 mindaro-dev.file-downloader-1.0.10 ms-azuretools.vscode-docker-1.1.0 ms-kubernetes-tools.vscode-kubernetes-tools-1.2.4 eamodio.gitlens-10.2.3 mindaro.mindaro-1.0.120210224 ms-azuretools.vscode-docker-1.10.0 redhat.vscode-yaml-0.15.0
rakeshvanga commented 3 years ago

@manojsaxenatda, When using Remote SSH feature of VS Code, did you follow the "Use Kubernetes Service Environment Variables" doc? The default steps would require administrator rights to run a process on remote machine which is not possible. Can you try setting up your project as listed in the above doc I've shared and let me know if you face any issues.

manojsaxenatda commented 3 years ago

Hi Rakesh

Thanks for your prompt reply. I did setup the task as below:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "bridge-to-kubernetes.service",
            "type": "bridge-to-kubernetes.service",
            "service": "halo-appinv",
            "ports": [
                32238
            ],
            "targetCluster": "kubernetes",
            "targetNamespace": "halo-sandbox",
            "useKubernetesServiceEnvironmentVariables": true
        }
    ]
}
rakeshvanga commented 3 years ago

@manojsaxenatda Along with changing the tasks.json file, after the debugging starts the code should use kubernetes service environment variables to work. But it seems that before that there is an exception in starting a debugging session. I should investigate further about the null ref exception.

manojsaxenatda commented 3 years ago

For the purpose of testing, I have allowed anyone to modify hosts file, and it didn't change anything as well.

rakeshvanga commented 3 years ago

@manojsaxenatda Can you describe how your K8s objects are setup? Does your setup of microservices contain K8s deployment object or just a service & pod combination? If so, there is an issue on our side that needs to looked at further.

In the meantime, to understand and explore more about Bridge To Kubernetes you can try our sample todo project and debug stats-api service using remote ssh capability.

manojsaxenatda commented 3 years ago

Hi Rakesh,

Services in our app are deployed in a K8 namespace. Every service has:

  1. an ingress rule to direct the traffic to service based on Virtual Host,
  2. K8 service
  3. K8 Stateful Set which launches pods, currently we have only one pod.
  4. Each pod has just one container.
rakeshvanga commented 3 years ago

@manojsaxenatda Thanks for sharing the details of your setup. Currently Bridge To Kubernetes doesn't support StatefulSets. We have planned it for our current sprint and should be available early April. Thanks!

manojsaxenatda commented 3 years ago

Thanks for the update,