microsoft / mindaro

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

Failed to get elevation requests prevents starting Bridge to Kubernetes #253

Open davidhcoe opened 2 years ago

davidhcoe commented 2 years ago

Describe the bug I cannot start debugging using Bridge to Kubernetes in VSCode.

To Reproduce Steps to follow to reproduce this issue.

**Expected behavior** I will be able to connect to the Kubernetes cluster to start debugging. **Logs** 2021-12-04T05:02:11.3174555Z | Library | TRACE | Pulling kubeconfig...\nOperation context: {"clientRequestId":null,"correlationId":"7c93194d-272f-4d82-8108-2cef76cf4fd81638593900220:c620ffae56f1:2ca7b4aa1096","requestId":null,"userSubscriptionId":null,"startTime":"2021-12-04T05:02:11.2652255Z","userAgent":"VSCode/1.0.120210803","requestHttpMethod":null,"requestUri":null,"version":"1.0.20210723.6","requestHeaders":{},"loggingProperties":{"applicationName":"Library","deviceOperatingSystem":"Microsoft Windows 10.0.19044","framework":".NET Core 3.1.9","macAddressHash":"cdf2808a3939b29c9efccb2cac450e7a564989515ea64c0e2908102f82e9d2eb","processId":22340,"targetEnvironment":"Production"}} 2021-12-04T05:02:11.6506697Z | Library | TRACE | Event: CloudProvider {"properties":{"clusterFQDNDomain":"AzurePublic"},"metrics":null} 2021-12-04T05:02:12.4431297Z | Library | TRACE | Dependency: Kubernetes {"target":"GetV1ServiceAsync","success":true,"duration":null,"properties":{}} 2021-12-04T05:02:12.6910973Z | Library | TRACE | Dependency: Kubernetes {"target":"ListPodsInNamespaceAsync","success":true,"duration":null,"properties":{}} 2021-12-04T05:02:12.7006689Z | Library | TRACE | Event: KubernetesRemoteEnvironmentManager-GetPodsFromService {"properties":{"result":"Succeeded"},"metrics":{"durationInMs":242.0}}\nOperation context: {"clientRequestId":null,"correlationId":"7c93194d-272f-4d82-8108-2cef76cf4fd81638593900220:c620ffae56f1:c93acea5b02b","requestId":null,"userSubscriptionId":null,"startTime":"2021-12-04T05:02:11.2652255Z","userAgent":"VSCode/1.0.120210803","requestHttpMethod":null,"requestUri":null,"version":"1.0.20210723.6","requestHeaders":{},"loggingProperties":{"applicationName":"Library","deviceOperatingSystem":"Microsoft Windows 10.0.19044","framework":".NET Core 3.1.9","macAddressHash":"cdf2808a3939b29c9efccb2cac450e7a564989515ea64c0e2908102f82e9d2eb","processId":22340,"targetEnvironment":"Production","isRoutingEnabled":false}} 2021-12-04T05:02:12.7043595Z | Library | TRACE | Resolved 1 from service. 2021-12-04T05:02:12.7056436Z | Library | TRACE | Max number of containers in pod: 1, min number of containers in pod: 1 2021-12-04T05:02:12.7059976Z | Library | TRACE | Chose pod 'controlplane-controlplane-6565fcb85b-gfmwb' with 1 containers 2021-12-04T05:02:12.7093216Z | Library | TRACE | Pod controlplane-controlplane-6565fcb85b-gfmwb owned by service controlplane-external contains 1 containers. 2021-12-04T05:02:12.7097087Z | Library | TRACE | Resolved source container controlplane 2021-12-04T05:02:12.7098670Z | Library | TRACE | Resolved 1 containers with exposed ports. 2021-12-04T05:02:12.7099466Z | Library | TRACE | Successfully got container from service and pod. 2021-12-04T05:02:12.7166991Z | Library | TRACE | Owning object type: ReplicaSet 2021-12-04T05:02:12.8092113Z | Library | TRACE | Dependency: Kubernetes {"target":"GetV1ReplicaSetAsync","success":true,"duration":null,"properties":{}} 2021-12-04T05:02:12.9183130Z | Library | TRACE | Dependency: Kubernetes {"target":"GetV1DeploymentAsync","success":true,"duration":null,"properties":{}} 2021-12-04T05:02:12.9185666Z | Library | TRACE | Resolved backing deployment: controlplane-controlplane 2021-12-04T05:02:12.9269559Z | Library | TRACE | Invoking kubectl GetContainerEnvironment command: exec controlplane-controlplane-6565fcb85b-gfmwb -c controlplane -n dev -- env 2021-12-04T05:02:12.9290052Z | Library | TRACE | Using kubectl found at: 'c:\Users\davidcoe\AppData\Roaming\Code\User\globalStorage\mindaro.mindaro\file-downloader-downloads\binaries\kubectl\win\kubectl.exe' 2021-12-04T05:02:13.9899630Z | Library | TRACE | Invoked kubectl GetContainerEnvironment command: 'exec controlplane-controlplane-6565fcb85b-gfmwb -c controlplane -n dev -- env' exited with 0 in 1056ms 2021-12-04T05:02:14.0129903Z | Library | TRACE | Loaded env var '' of type VerbatimToken: {"Name":""} => true 2021-12-04T05:02:14.0138180Z | Library | TRACE | Loaded env var '' of type VerbatimToken: {"Name":""} => 5002 2021-12-04T05:02:14.0141409Z | Library | TRACE | Loaded env var '' of type VerbatimToken: {"Name":""} => false 2021-12-04T05:02:14.0142559Z | Library | TRACE | Loaded env var '' of type VerbatimToken: {"Name":""} => false 2021-12-04T05:02:14.0143411Z | Library | TRACE | Loaded env var '' of type VerbatimToken: {"Name":""} => false 2021-12-04T05:02:14.0144241Z | Library | TRACE | Loaded env var '' of type VerbatimToken: {"Name":""} => false 2021-12-04T05:02:14.0145136Z | Library | TRACE | Loaded env var '' of type VerbatimToken: {"Name":""} => true 2021-12-04T05:02:14.0164309Z | Library | TRACE | Loaded env var 'secrets-volume' of type VolumeToken: {"LocalPath":"","Name":"secrets-volume"} => 2021-12-04T05:02:14.1934517Z | Library | TRACE | Dependency: Kubernetes {"target":"ListServicesInNamespaceAsync","success":true,"duration":null,"properties":{}} 2021-12-04T05:02:14.2053841Z | Library | TRACE | Detected headless service. Looking for endpoints with same name as service... 2021-12-04T05:02:14.2971060Z | Library | TRACE | Dependency: Kubernetes {"target":"GetEndpointInNamespaceAsync","success":true,"duration":null,"properties":{}} 2021-12-04T05:02:14.2980122Z | Library | TRACE | Detected headless service. Looking for endpoints with same name as service... 2021-12-04T05:02:14.3746236Z | Library | TRACE | Dependency: Kubernetes {"target":"GetEndpointInNamespaceAsync","success":true,"duration":null,"properties":{}} 2021-12-04T05:02:14.3748290Z | Library | TRACE | Detected headless service. Looking for endpoints with same name as service... 2021-12-04T05:02:14.4480396Z | Library | TRACE | Dependency: Kubernetes {"target":"GetEndpointInNamespaceAsync","success":true,"duration":null,"properties":{}} 2021-12-04T05:02:14.4494900Z | Library | TRACE | Detected headless service. Looking for endpoints with same name as service... 2021-12-04T05:02:14.5220042Z | Library | TRACE | Dependency: Kubernetes {"target":"GetEndpointInNamespaceAsync","success":true,"duration":null,"properties":{}} 2021-12-04T05:02:14.5241289Z | Library | WARNG | Unsupported protocol 'UDP' identified in service 'mdm' 2021-12-04T05:02:14.5250000Z | Library | TRACE | Event: WorkloadInformationProvider-GetReachableEndpoints {"properties":{"result":"Failed"},"metrics":{"durationInMs":504.0}} 2021-12-04T05:02:14.5251841Z | Library | TRACE | Event: ConnectManagementClient-GetElevationRequests {"properties":{"result":"Failed"},"metrics":{"durationInMs":2820.0}} 2021-12-04T05:02:14.5258534Z | Library | ERROR | Failed to get elevation requests. 2021-12-04T05:02:14.5499219Z | 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.Connect.WorkloadInformationProvider._CollectServicesToRouteAsync(String workloadNamespace, IEnumerable`1 services, CancellationToken cancellationToken)\r\n at Microsoft.BridgeToKubernetes.Library.Connect.WorkloadInformationProvider.GetReachableEndpointsAsync(String namespaceName, ILocalProcessConfig localProcessConfig, Boolean includeSameNamespaceServices, CancellationToken cancellationToken)\r\n at Microsoft.BridgeToKubernetes.Library.ManagementClients.ConnectManagementClient.<>c__DisplayClass18_0.<b__0>d.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\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} **Environment Details** Client used (VS Code/Visual Studio): mindaro.mindaro@1.0.120210803 Client's version: Operating System: Windows 10 **Additional context** Add any other outputs from the clients or context you would like to share.
amsoedal commented 2 years ago

Hey @davidhcoe, Is there any chance your headless service is missing a "ports" field in the service spec? If so can you try the workaround mentioned here? https://github.com/microsoft/mindaro/issues/209#issuecomment-887654542