Coder Social home page Coder Social logo

azure / bridge-to-kubernetes Goto Github PK

View Code? Open in Web Editor NEW
197.0 15.0 55.0 4.22 MB

Bridge To Kubernetes (B2K) is development tool to debug microservices, pods which redirects traffic to your local development machine and vice versa.

Home Page: https://learn.microsoft.com/en-us/visualstudio/bridge/overview-bridge-to-kubernetes

License: Other

PowerShell 0.43% Shell 0.96% C# 98.38% Dockerfile 0.23%
azure kubernetes local-debugging

bridge-to-kubernetes's Introduction

Bridge to Kubernetes

Build Status

CodeQL

Welcome to Bridge-To-Kubernetes! Bridge to Kubernetes extends the Kubernetes perimeter to your development computer allowing you to write, test, and debug microservice code while connected to your Kubernetes cluster with the rest of your application or services. You can simply run your code natively on your development workstation while connected to the Kubernetes cluster, allowing you to test your code changes in the context of the larger application.

Introduction Video

https://learn.microsoft.com/en-us/shows/open-at-microsoft/get-started-with-bridge-to-kubernetes

image002

Key Features:

Simplifying Microservice Development

  • Eliminate the need to manually source, configure and compile external dependencies on your development computer.

Easy Debugging

  • Run your usual debug profile with the added cluster configuration. You can debug your code as you normally would while taking advantage of the speed and flexibility of local debugging.

Developing and Testing End-to-End

  • Test end-to-end during development time. Select an existing service in the cluster to route to your development machine where an instance of that service is running locally. Request initiated through the frontend of the application running in Kubernetes will route between services running in the cluster until the service you specified to redirect is called.

Documentation

CLI tool installation

  • curl -fsSL https://raw.githubusercontent.com/Azure/Bridge-To-Kubernetes/main/scripts/install.sh | bash
  • Supports Linux, Darwin, Windows - use WSL (installation link here) or Git Bash (installation link here)

How to use the CLI

  • run the following command dsc connect --service <service-name> --local-port <port-number> --namespace <namespace> --use-kubernetes-service-environment-variables
  • example is dsc connect --service stats-api --local-port 3001 --namespace todo-app
  • for help dsc --help
  • for version dsc --version

Microsoft Open Source Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow [Microsoft’s Trademark & Brand Guidelines] (https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks). Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party’s policies.

Security Reporting Guidance

Checkout the SECURITY.md file in this repo for details.

Data Collection

The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.

Support

Bridge to Kubernetes is an open source project that is not covered by the Microsoft Azure support policy. Please search open issues here, and if your issue isn't already represented please open a new one. The project maintainers will respond to the best of their abilities and triage the most urgent bugs.

bridge-to-kubernetes's People

Contributors

ababilone avatar ajaffie avatar bartnetjs avatar cxznmhdcxz avatar dependabot[bot] avatar dgarberj avatar elenavillamil avatar eneuman avatar gambtho avatar garyburgmann avatar gatoonjin avatar hsubramanianaks avatar jamiemagee avatar maksimr avatar markphillips100 avatar microsoft-github-operations[bot] avatar microsoftopensource avatar qpetraroia avatar sajayantony avatar step-security-bot avatar strayfe avatar tatsinnit avatar tbarnes94 avatar vidya2606 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bridge-to-kubernetes's Issues

B2K Crashes when debugging code in VS 2022

Describe the bug
If debugging in VS 2022 and standing still on a breakpoint for more then 60 sec, the restore agent crashes and you need to manually redeploy the services again.

The error logg recived in the restore againt pod before crashes is this:

2022-11-10T11:36:56.0434535Z | RestorationJob | TRACE | Event: RestorationJob-AgentPing <json>{"eventName":"RestorationJob-AgentPing","properties":{"restorePerformed":"false","numFailedPings":"10","hasConnectedClients":"","result":"Failed"},"metrics":{"durationInMs":12.0}}</json>
2022-11-10T11:37:01.0574230Z | RestorationJob | ERROR | Logging handled exception: System.ArgumentNullException: {"ClassName":"System.ArgumentNullException","Message":"Value cannot be null.","Data":null,"InnerException":null,"HelpURL":null,"StackTraceString":"   at k8s.AbstractKubernetes.ReadNamespacedDeploymentWithHttpMessagesAsync(String name, String namespaceParameter, Nullable`1 pretty, IReadOnlyDictionary`2 customHeaders, CancellationToken cancellationToken)\n   at k8s.KubernetesExtensions.ReadNamespacedDeploymentAsync(IBasicKubernetes operations, String name, String namespaceParameter, Nullable`1 pretty, CancellationToken cancellationToken)\n   at Microsoft.BridgeToKubernetes.Common.Kubernetes.KubernetesClient.<>c__DisplayClass63_0.<<GetV1DeploymentAsync>b__0>d.MoveNext() in /src/common/Kubernetes/KubernetesClient.cs:line 683\n--- End of stack trace from previous location where exception was thrown ---\n   at Microsoft.BridgeToKubernetes.Common.Kubernetes.KubernetesClient.<>c__DisplayClass75_0`1.<<ClientInvokeWrapperAsync>b__0>d.MoveNext() in /src/common/Kubernetes/KubernetesClient.cs:line 1058\n--- End of stack trace from previous location where exception was thrown ---\n   at Microsoft.BridgeToKubernetes.Common.Utilities.WebUtilities.RetryUntilTimeAsync(Func`2 action, TimeSpan maxWaitTime, CancellationToken cancellationToken) in /src/common/Utilities/WebUtilities.cs:line 112\n   at Microsoft.BridgeToKubernetes.Common.Kubernetes.KubernetesClient.ClientInvokeWrapperAsync[T](Func`1 handler, String operation, CancellationToken cancellationToken) in /src/common/Kubernetes/KubernetesClient.cs:line 1054\n   at Microsoft.BridgeToKubernetes.Common.Kubernetes.KubernetesClient.<>c__DisplayClass24_0.<<ListPodsForDeploymentAsync>b__0>d.MoveNext() in /src/common/Kubernetes/KubernetesClient.cs:line 202\n--- End of stack trace from previous location where exception was thrown ---\n   at Microsoft.BridgeToKubernetes.Common.Kubernetes.KubernetesClient.<>c__DisplayClass75_0`1.<<ClientInvokeWrapperAsync>b__0>d.MoveNext() in /src/common/Kubernetes/KubernetesClient.cs:line 1058\n--- End of stack trace from previous location where exception was thrown ---\n   at Microsoft.BridgeToKubernetes.Common.Utilities.WebUtilities.RetryUntilTimeAsync(Func`2 action, TimeSpan maxWaitTime, CancellationToken cancellationToken) in /src/common/Utilities/WebUtilities.cs:line 112\n   at Microsoft.BridgeToKubernetes.Common.Kubernetes.KubernetesClient.ClientInvokeWrapperAsync[T](Func`1 handler, String operation, CancellationToken cancellationToken) in /src/common/Kubernetes/KubernetesClient.cs:line 1054\n   at Microsoft.BridgeToKubernetes.DevHostAgent.RestorationJob.RestorationJobApp._GetAgentEndpointAsync(DeploymentPatch deploymentPatch, CancellationToken cancellationToken) in /src/devhostagent.restorationjob/RestorationJobApp.cs:line 236","RemoteStackTraceString":null,"RemoteStackIndex":0,"ExceptionMethod":null,"HResult":-2147467261,"Source":"KubernetesClient.Basic","WatsonBuckets":null,"ParamName":"namespaceParameter"}
2022-11-10T11:37:01.0586013Z | RestorationJob | TRACE | Event: RestorationJob-AgentPing <json>{"eventName":"RestorationJob-AgentPing","properties":{"restorePerformed":"false","numFailedPings":"11","hasConnectedClients":"","result":"Failed"},"metrics":{"durationInMs":13.0}}</json>
2022-11-10T11:37:01.0590880Z | RestorationJob | ERROR | Failed to ping agent 12 times. Exiting...
2022-11-10T11:37:01.1290258Z | RestorationJob | TRACE | AssemblyLoadContext unloading
2022-11-10T11:37:01.1299823Z | RestorationJob | TRACE | Process exiting...
2022-11-10T11:37:01.1303579Z | RestorationJob | TRACE | Process exited
Stream closed EOF for default/klinikportalservice-restore-71af2-gvknx (lpkrestorationjob)

Mention the platform you are using
Visual Studio 2022

To Reproduce
Steps to reproduce the behavior:

  1. Start Visual Studio 2022 and setup a regular B2K project.
  2. Deploy it to your k8
  3. Set a breakpoint in your code
  4. Make your breakpoint hit by navigate to the webpage using a browser
  5. Wait for 60 sec while examining the log output from the restore pod
  6. After the pod has made 12 attempts of RestorationJob-AgentPing it crashed and both the restore pod and your service ends up in a unfixable state.

Expected behavior
I should be able to stay still on a breakpoint for mor then 60 sec,

Desktop (please complete the following information):
Windows 11

Dotnet 6 Upgrade - Disconnecting B2K Fails

Describe the bug
After upgrading using the PR B2K connection is established but while disconnecting fails and leaves the devhost agent restore pod active in the k8s cluster.

Mention the platform you are using
linux, WSL2 and Mac OS

To Reproduce
Steps to reproduce the behavior:

  1. Install the VSIX for dotnet 6 upgrade and set the BRIDGE_ENVIRONMENT as dev
  2. Configure Bridge using command palette
  3. Start the debug session, connects fine
  4. Stopping the debug session fails with error ECONNREFUSED

Expected behavior
Stopping the debug session should disconnect successfully.

Screenshots
MicrosoftTeams-image

Desktop (please complete the following information):

  • OS: OSX, Linux, WSL2

Additional context
The root cause of this issue is due to /api/remoting/stop endpoint should run on port from screenshot, and vscode extension invokes this endpoint to terminate b2k session. While debugging we found that this endpoint is available for a moment but at later point of time it is cancelled using CancellationTokenSource.Cancel. We are investigating further to see what has changed in dotnet 6.0 vs dotnet 3.1. this could be related. Maybe we should change it to TryReset instead of Cancel.

DevAgent ReversePortForwardManger Remote Connection Closed error

I am running latest extension from vscode with local k3s using ubuntu 20.04. Everything works when debugging a non-edge (front end) container. However, when trying to debug a edge (front end) container it never hits the break point. Looking at the devagent logs I see the websocket is created, then immediately, the "remote connection closed". The restoration agent container continues to fail after 12 unsuccessful ping attempts (connection refused) to the devagent container. After stopping the debug session the restoration job never executes because of the connection problem. The only difference between the edge container and non-edge container is the edge container is using aspnetcore kestrel. I thought maybe this was related to running behind a reverse proxy so I set the allowedhosts setting to localhost, but no luck.
bridge-library.txt
bridge-restoration-job.log

Visual Studio tutorial doesn't work

I am following https://docs.microsoft.com/en-us/visualstudio/bridge/bridge-to-kubernetes-vs

In the prerequisites it says "The Bridge to Kubernetes extension for Visual Studio." but this is a Visual Studio Code extension

After finding the Bridge to Kubernetes extension in VS2022 extensions menu I attempted to follow the rest of the tutorial - I get stuck at "In the project, select Bridge to Kubernetes from the launch settings as shown here:" these are the options I get:

image

lifecycle hooks cause issues

Describe the bug
The container that is spun up (isolated) copies across the lifecycle hooks from the container of context. In this instance, hooks dependent on paths for example will fail.

Mention the platform you are using
Not platform specific, but verified against Mac, Windows, Debian all the same

To Reproduce
Steps to reproduce the behavior:

  1. Create a container with lifecycle hooks, i.e. postStart
  2. Have that lifecycle hook depend on a path built into your container, i.e. WORKDIR /foo/bar
  3. Run the bridge and get CrashLoopBackOff on the container.

Expected behavior
If the container does not respect the same working directories as the target container, then copying lifecycle hooks across is less than ideal.

Screenshots

$ kubectl -n my-ns get pod isolated-foo-78d99c4c56-8zjsh -o yaml
...
    image: bridgetokubernetes.azurecr.io/lpkremoteagent:0.1.8
    imagePullPolicy: IfNotPresent
    lifecycle:
      postStart:
        exec:
          command:
          - /bin/sh
          - -c
          - /foo/bar/bin/run migrations:migrate && /foo/bar/bin/run cache:clear
      preStop:
        exec:
          command:
          - sleep
          - "90"
 ...

Additional context
Philosophical differences aside re: how postStart is being used here, the fact that we are potentially dependent on non-existing paths is problematic.

Windows + Docker Desktop (Kubernetes) + Bridge = Docker desktop stops on vs code attempt to debug

Describe the bug
Windows + Docker Desktop (Kubernetes) + Bridge = Docker desktop stops on vs code attempt to debug

Immediate after terminal logs show "Container port .. is available at localhost:null." docker desktop shutsdown entirely and everything else that bridge to kubernetes does fails. (i.e. mapping volumes)

Mention the platform you are using
Windows 11 (latest) + VS Code (latest) + Docker Desktop (latest)

To Reproduce
Steps to reproduce the behavior:

  1. Add the default bridge to kubernetes debug setup from an existing project
  2. Run the debug.
  3. See error

Expected behavior
Should run properly and not shut down docker desktop on startup.

Screenshots
Container port 5017 is available at localhost:null.
Downloading volume 'identity-encryption' from '/certificates/identity-encryption' ...
Downloading from '/certificates/identity-encryption' ...
Download failed with error: An error occurred while sending the request.
Retrying ...

image

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser Edge
  • Version Latest mainline

Additional context
I have a KubernetesLocalProcessConfig.yaml that maps a bunch of environment variables if that matters.

Here's my tasks:

        {
            "label": "bridge-to-kubernetes.contacts.resource",
            "type": "bridge-to-kubernetes.resource",
            "resource": "contacts",
            "resourceType": "service",
            "ports": [
                0
            ],
            "targetCluster": "pltfrmd",
            "targetNamespace": "pltfrmd",
            "useKubernetesServiceEnvironmentVariables": false
        },
        {
            "label": "bridge-to-kubernetes.contacts.compound",
            "dependsOn": [
                "bridge-to-kubernetes.contacts.resource",
                "build_contacts"
            ],
            "dependsOrder": "sequence"
        },

Here's my launch configuration:

        {
            "name": "Contacts with Kubernetes",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "bridge-to-kubernetes.contacts.compound",
            "program": "${workspaceFolder}/Services/Contacts/bin/Debug/net7.0/Contacts.dll",
            "args": [],
            "cwd": "${workspaceFolder}/Services/Contacts",
            "stopAtEntry": false,
            "env": {
                "ASPNETCORE_ENVIRONMENT": "Development"
            }
        },


The image attached comes up before it tries. Of course, 443 is used by the ingress on the cluster and of course has to be used by the cluster, so I'm not sure what this means and why I'd be getting this error message.

Permission denied error in 'Adding rules to routing table' on linux(openSUSE)

Describe the bug
Could not complete setup with bellow errror log(/tmp/Bridge To Kubernetes/bridge-endpointmanager-....txt)

2022-08-30T09:56:54.8363627Z | EndpointManager | TRACE | Received request segment: '{"argument":[{"dnsName":"todos-db","localIP":null,"ports":[{"localPort":55049,"remotePort":27017,"protocol":"TCP"}],"isExternalEndpoint":false,"isInWorkloadNamespace":true},{"dnsName":"database-api","localIP":null,"ports":[{"localPort":55050,"remotePort":80,"protocol":"TCP"}],"isExternalEndpoint":false,"isInWorkloadNamespace":true},{"dnsName":"stats-api","localIP":null,"ports":[{"localPort":55051,"remotePort":80,"protocol":"TCP"}],"isExternalEndpoint":false,"isInWorkloadNamespace":true},{"dnsName":"stats-cache","localIP":null,"ports":[{"localPort":55052,"remotePort":6379,"protocol":"TCP"}],"isExternalEndpoint":false,"isInWorkloadNamespace":true},{"dnsName":"stats-queue","localIP":null,"ports":[{"localPort":55053,"remotePort":5672,"protocol":"TCP"}],"isExternalEndpoint":false,"isInWorkloadNamespace":true},{"dnsName":"frontend","localIP":null,"ports":[{"localPort":55054,"remotePort":80,"protocol":"TCP"}],"isExternalEndpoint":false,"isInWorkloadNamespace":true}],"apiname":"AllocateIP","correlationId":"29350fa4-d86a-4eb7-b094-a4367d8f35a81661853327401:7d9c80d35177:64bf8713aef2:2e254ae4ad7e"}<EOF>' of size 1109
2022-08-30T09:56:54.8371903Z | EndpointManager | TRACE | Allocating IP...\nOperation context: <json>{"clientRequestId":null,"correlationId":"29350fa4-d86a-4eb7-b094-a4367d8f35a81661853327401:7d9c80d35177:64bf8713aef2:2e254ae4ad7e:0b2fd8690088","requestId":null,"userSubscriptionId":null,"startTime":"2022-08-30T09:51:23.3840112Z","userAgent":"EndpointManager/1.0.20220816.2","requestHttpMethod":null,"requestUri":null,"version":"1.0.20220816.2","requestHeaders":{},"loggingProperties":{"applicationName":"EndpointManager","deviceOperatingSystem":"Linux 5.3.18-150300.59.76-default #1 SMP Thu Jun 16 04:23:47 UTC 2022 (2cc2ade)","framework":".NET Core 3.1.9","macAddressHash":"cc0cb0cbd2721c64e2fb9c6790b02bbc7ad534fc5869b2abb08e886ea84e2d8d","processId":28524,"targetEnvironment":"Production"}}</json>
2022-08-30T09:56:54.8373159Z | EndpointManager | TRACE | Allocated IP 127.1.1.7
2022-08-30T09:56:54.8373904Z | EndpointManager | TRACE | Allocating IP...
2022-08-30T09:56:54.8374387Z | EndpointManager | TRACE | Allocated IP 127.1.1.8
2022-08-30T09:56:54.8374853Z | EndpointManager | TRACE | Allocating IP...
2022-08-30T09:56:54.8375318Z | EndpointManager | TRACE | Allocated IP 127.1.1.9
2022-08-30T09:56:54.8375832Z | EndpointManager | TRACE | Allocating IP...
2022-08-30T09:56:54.8376315Z | EndpointManager | TRACE | Allocated IP 127.1.1.10
2022-08-30T09:56:54.8376733Z | EndpointManager | TRACE | Allocating IP...
2022-08-30T09:56:54.8377199Z | EndpointManager | TRACE | Allocated IP 127.1.1.11
2022-08-30T09:56:54.8377726Z | EndpointManager | TRACE | Allocating IP...
2022-08-30T09:56:54.8378179Z | EndpointManager | TRACE | Allocated IP 127.1.1.12
2022-08-30T09:56:54.8379039Z | EndpointManager | TRACE | Adding rules to routing table...
2022-08-30T09:56:54.8379631Z | EndpointManager | TRACE | Running 'iptables --table nat --append PREROUTING -p tcp --dst 127.1.1.7 --dport 27017 --jump DNAT --to-destination 127.1.1.7:55049'
2022-08-30T09:56:54.8387770Z | EndpointManager | TRACE | Event: IP-AddRoutingRules <json>{"properties":{"result":"Failed"},"metrics":{"durationInMs":0.0}}</json>
2022-08-30T09:56:54.8389074Z | EndpointManager | TRACE | Event: IP-AllocateIP <json>{"properties":{"result":"Failed"},"metrics":{"durationInMs":1.0}}</json>
2022-08-30T09:56:54.8433691Z | EndpointManager | ERROR | Logging handled exception: System.ComponentModel.Win32Exception: {"ClassName":"System.ComponentModel.Win32Exception","Message":"Permission denied","Data":null,"InnerException":null,"HelpURL":null,"StackTraceString":"   at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)\n   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)\n   at System.Diagnostics.Process.Start()\n   at Microsoft.BridgeToKubernetes.Common.IO.Platform.Execute(String executable, String command, Action`1 stdOutCallback, Action`1 stdErrCallback, IDictionary`2 envVariables, TimeSpan timeout, CancellationToken cancellationToken, String& stdOutOutput, String& stdErrOutput)\n   at Microsoft.BridgeToKubernetes.Common.IO.Platform.Execute(String executable, String command, Action`1 logCallback, IDictionary`2 envVariables, TimeSpan timeout, CancellationToken cancellationToken, String& output)\n   at Microsoft.BridgeToKubernetes.Common.IP.IPManager.RunUtility(String executable, String args, CancellationToken cancellationToken)\n   at Microsoft.BridgeToKubernetes.Common.IP.IPManager.AddRoutingRules(IEnumerable`1 endpoints, CancellationToken cancellationToken)\n   at Microsoft.BridgeToKubernetes.Common.IP.IPManager.AllocateIPs(IEnumerable`1 endpoints, Boolean addRoutingRules, CancellationToken cancellationToken)\n   at Microsoft.BridgeToKubernetes.EndpointManager.EndpointManager.<>c__DisplayClass23_0.<ProcessClientCallsAsync>b__1()\n   at Microsoft.BridgeToKubernetes.EndpointManager.EndpointManager.InvokeWithExceptionHandler[T](Func`1 handler)","RemoteStackTraceString":null,"RemoteStackIndex":0,"ExceptionMethod":null,"HResult":-2147467259,"Source":"System.Diagnostics.Process","WatsonBuckets":null,"NativeErrorCode":13}
2022-08-30T09:56:54.8462765Z | EndpointManager | TRACE | Sending response: '{"value":null,"isSuccess":false,"errorMessage":"Permission denied","errorType":"InvalidOperation"}'
2022-08-30T09:56:54.8463717Z | EndpointManager | TRACE | 103 bytes were sent.

Mention the platform you are using
vscode

To Reproduce
Steps to reproduce the behavior:

trying tutorial: https://docs.microsoft.com/en-us/visualstudio/bridge/bridge-to-kubernetes-sample

  1. 'Click the start button next to Run Script: dev with Kubernetes.'
  2. An error occurred, and TERMINAL output is bellow
Executing task: bridge-to-kubernetes.resource 

Redirecting Kubernetes service stats-api to your machine...
Target cluster: sri-dev
Current cluster: sri-dev
Target namespace: simamura
Current namespace: simamura
Target service name: stats-api
Target service ports: 3001
Using kubernetes service environment variables: false

Retrieving the current context and credentials...
Validating the credentials to access the cluster...
Validating the requirements to replicate resources locally...
Redirecting traffic from the cluster to your machine...
Waiting for 'stats-api-56d8db88cd-w7dbc' in namespace 'simamura' to reach running state...
Deployment 'simamura/stats-api' patched to run agent.
Remote agent deployed in container 'stats-api' in pod 'stats-api-56d8db88cd-w7dbc'.
Preparing to run Bridge To Kubernetes configured as pod simamura/stats-api-56d8db88cd-w7dbc ...
Connection established.
Connect operation failed.
Stopping workload and cleaning up...
Restore: Deployment 'stats-api' restored to original state with image 'azdspublic/todo-app-stats-api'.
An unexpected error occurred: 'Permission denied'
To see our active issues or file a bug report, please visit https://aka.ms/bridge-to-k8s-report.

Error: Failed to establish a connection. Error: Connect operation failed.
An unexpected error occurred: 'Permission denied'
To see our active issues or file a bug report, please visit https://aka.ms/bridge-to-k8s-report.


 *  The terminal process terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 
  1. See error

Expected behavior
Finish to connect k8s cluster.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: openSUSE Leap 15.3
  • Browser: not running
  • Version: VS Code v1.70.2 - Extension v1.0.120220817

Additional context

  • Elevation privillage dialog was open. And enter correct root user's password.
  • As root user, iptables command in error log is succes.
# whoami
root
# iptables --table nat --append PREROUTING -p tcp --dst 127.1.1.7 --dport 27017 --jump DNAT --to-destination 127.1.1.7:55049
# iptables -n --table nat -L PREROUTING
Chain PREROUTING (policy ACCEPT)
target     prot opt source               destination
DOCKER     all  --  0.0.0.0/0            0.0.0.0/0            ADDRTYPE match dst-type LOCAL
DNAT       tcp  --  0.0.0.0/0            127.1.1.7            tcp dpt:27017 to:127.1.1.7:55049

Setting useKubernetesServiceEnvironmentVariables to true causes crash

This is a copy of microsoft/mindaro#236 which I ran into today while trying to use VSCode and bridge-to-kubernetes on a remote linux machine.

Describe the bug

When I set useKubernetesServiceEnvironmentVariables to 'true' (defaults to 'false') in the bridge-to-kubernetes.resource definition in tasks.json and launch the debugger the startup crashes with the following error:

Failed to establish a connection. Error: Port 55049 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.

To Reproduce

After configuring for local tunneling, edit the bridge-to-kubernetes.resource task in tasks.json and set the useKubernetesServiceEnvironmentVariables entry to 'true'. Start a debug session and watch the terminal output to see the crash, followed by a popup asking if you want to abort.

Expected behavior

The service should launch locally and run with environment variables set based on those defined in the Kubernetes cluster.

Logs

2021-09-30T21:55:53.6974830Z | MindaroCli | TRACE | Event: Command.Start {"properties":{"arguments":"connect --service harmony-service-example --env /var/folders/_6/zt0qbjxd17s4qww0_yvyd_6hh1tml0/t/tmp-33222vinl08njw5l5.env --script /var/folders/_6/zt0qbjxd17s4qww0_yvyd_6hh1tml0/t/tmp-33222vinl08njw5l5.env.cmd --control-port 56952 --ppid 33220 --namespace argo --use-kubernetes-service-environment-variables --local-port 5000","isRoutingEnabled":"false"},"metrics":null}\nOperation context: {"clientRequestId":null,"correlationId":"916f3eab-c305-4084-b51d-f1aca7aabe071633038193418:f873b9ff7bae","requestId":null,"userSubscriptionId":null,"startTime":"2021-09-30T21:55:53.3827450Z","userAgent":"VSCode/1.0.120210803","requestHttpMethod":null,"requestUri":null,"version":"1.0.20210723.6","requestHeaders":{},"loggingProperties":{"applicationName":"MindaroCli","deviceOperatingSystem":"Darwin 19.6.0 Darwin Kernel Version 19.6.0: Tue Aug 24 20:28:00 PDT 2021; root:xnu-6153.141.401/RELEASE_X86_64","framework":".NET Core 3.1.9","macAddressHash":"dfbe6f9a64e3bb8239cbbb6ade76cf8e2ed251f1e181db90169abb316e750214","processId":34559,"targetEnvironment":"Production","commandId":"f873b9ff7bae"}}
2021-09-30T21:55:53.7753520Z | MindaroCli | TRACE | Running Microsoft.BridgeToKubernetes.Exe.Commands.Connect.ConnectCommand...\nOperation context: {"clientRequestId":null,"correlationId":"916f3eab-c305-4084-b51d-f1aca7aabe071633038193418:f873b9ff7bae","requestId":null,"userSubscriptionId":null,"startTime":"2021-09-30T21:55:53.3827450Z","userAgent":"VSCode/1.0.120210803","requestHttpMethod":null,"requestUri":null,"version":"1.0.20210723.6","requestHeaders":{},"loggingProperties":{"applicationName":"MindaroCli","deviceOperatingSystem":"Darwin 19.6.0 Darwin Kernel Version 19.6.0: Tue Aug 24 20:28:00 PDT 2021; root:xnu-6153.141.401/RELEASE_X86_64","framework":".NET Core 3.1.9","macAddressHash":"dfbe6f9a64e3bb8239cbbb6ade76cf8e2ed251f1e181db90169abb316e750214","processId":34559,"targetEnvironment":"Production","commandId":"f873b9ff7bae","targetServiceName":"harmony-service-example","isRoutingEnabled":false}}
2021-09-30T21:55:56.1677600Z | MindaroCli | TRACE | Remoting started listening on 56952
2021-09-30T21:56:02.3334980Z | MindaroCli | TRACE | Connection established.\n
2021-09-30T21:56:02.5152590Z | MindaroCli | WARNG | Port 55049 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.
2021-09-30T21:56:02.5155230Z | MindaroCli | ERROR | Port 55049 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
2021-09-30T21:56:02.5159700Z | MindaroCli | TRACE | Stopping workload and cleaning up...\n
2021-09-30T21:56:03.7285030Z | MindaroCli | TRACE | Event: Command.End {"properties":{"arguments":"connect --service harmony-service-example --env /var/folders/_6/zt0qbjxd17s4qww0_yvyd_6hh1tml0/t/tmp-33222vinl08njw5l5.env --script /var/folders/_6/zt0qbjxd17s4qww0_yvyd_6hh1tml0/t/tmp-33222vinl08njw5l5.env.cmd --control-port 56952 --ppid 33220 --namespace argo --use-kubernetes-service-environment-variables --local-port 5000","result":"Failed","failureReason":"Port 55049 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":10092.0}}

Environment Details

Client used (VS Code):
[email protected]
Client's version:
Operating System:
macOS Catalina
Additional context
The service launches and runs if I set useKubernetesServiceEnvironmentVariables to 'false', but of course the environment variables are not set in that case.

Failed to launch endpoint manager

Receive error when debugging in vscode on linux with latest version of b2k, unable to launch endpoint manager

vscode ubuntu 20.04

Bridge to Kubernetes initialization (VS Code v1.73.1 - Extension v1.0.120221031)
Logs: /home/steve/.config/Code/logs/20221110T145302/window1/exthost/mindaro.mindaro/mindaro-vscode-2022-11-10T20-53-08.103Z.txt
Waiting for EndpointManager to come up ...
An unexpected error occurred: 'Failed to launch EndpointManager.'
To see our active issues or file a bug report, please visit https://aka.ms/bridge-to-k8s-report.
For diagnostic information, see logs at '/tmp/Bridge To Kubernetes'.
Failed to establish a connection. Error: An unexpected error occurred: 'Failed to launch EndpointManager.'
To see our active issues or file a bug report, please visit https://aka.ms/bridge-to-k8s-report.
For diagnostic information, see logs at '/tmp/Bridge To Kubernetes'.

bridge-mindarocli-2022-11-11-18-46-33-205421.txt

Not the expected error message when the schema is not valid

Describe the bug
Not the expected error message when the schema is not valid

Mention the platform you are using
Windows, VS 2022

To Reproduce
Steps to reproduce the behavior:

  1. Open samples\todo-app\database-api\databaseApi.csproj project with VS 2022
  2. Create a new file at the root of the project called KubernetesLocalProcessConfig.yaml
  1. Right click 'Add' -> 'New Item' on solution explorer
  2. Scroll down to 'YAML File', and enter 'KubernetesLocalProcessConfig.yaml'
  1. Add the following content to this file and save:
version: 50.0
env:
    - name: FOO
      value: bar
  1. Select Container in Kubernetes option from the debug dropdown menu.
  2. Select the start button next to Bridge to Kubernetes. In the Create profile for Bridge to Kubernetes dialog box, enter the following values:

Select your cluster name.
Select todo-app for your namespace.
Select database-api for the Service to redirect.
Select the same URL you used previously to launch your browser.

  1. Select Save and debug
  2. See error: A connection to the cluster couldn't be established.
    image

Expected behavior
Bridge to Kubernetes fails, with an error message in the output window like "Bridge to Kubernetes process config file is using an unsupported version"

Screenshots
image

Additional context
Low priority

Some environment variables are not set in the deployment.yaml

I search the whold repo by keyword 'TODOS_DB_SERVICE_HOST', but i can not find any place to set this environment variable .
Environment.GetEnvironmentVariable("TODOS_DB_SERVICE_HOST")
Environment.GetEnvironmentVariable("TODOS_DB_SERVICE_PORT")

Port already in use when initiating bridge

I'm trying to enable a bridge between my local and a Kubernetes cluster running in Ubuntu. Some of the services are available on multiple ports, i.e. Vault. When I start the configuration I get the following error:

Service 'demoapp' is available on 127.0.0.1:55059. 
Service 'vault-0.vault-internal' is available on 127.0.0.1:55060.
Service 'vault-0.vault-internal' is available on 127.0.0.1:55061.
Port 55060 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.

It seems like Bridge to Kubernetes is trying to allocate the same port twice. I don't think it's an issue with the local computer since before this I was also running Confluent and it got past these ports before having the same issue.

Service 'my-confluent-cp-zookeeper-2.my-confluent-cp-zookeeper-headless' is available on 127.0.0.1:55073.
Service 'my-confluent-cp-zookeeper-2.my-confluent-cp-zookeeper-headless' is available on 127.0.0.1:55074.
Port 55073 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.

Can you help me get this working? Thanks

Support for Private Registries

We're getting an "ImagePullBackOff" for the routing manager pod as well as the others due to a corporate proxy.
It would be great to have support for downloading these images from our private registry (such as Artifactory) and being able to add a prefix to the image (e.g. PRIVATE_REPO/bridgetokubernetes.azurecr.io/lpkremoteagent or PRIVATE_REPO/lpkremoteagent)

Much thanks in advance!

Referencing this issue : microsoft/mindaro#147

Support policy for Bridge to Kubernetes

Hi everyone!

The AKS team is thrilled to take ownership of Bridge to Kubernetes and open source it for the whole community, but while we have you here, we wanted to make sure that everyone is aware of the support policy for Bridge. Currently the team is still ramping up with the codebase as well as making sure we have not missed anything in the transfer from the old team to AKS. During this time, you may not see us respond as fast to your feature requests, feedback, etc as you may like. All these items will be triaged accordingly, and we will work as a team to respond as fast as possible. If you have any more questions, please feel free to open a new issue, or respond below.

Thank you for using Bridge to Kubernetes!

The JSON value could not be converted to k8s.Models.V1ServiceStatus

Describe the bug
When trying to start a debugging session in VS Code, I see following error in B2K VS Code output:

Failed to establish a connection. Error: Connect operation failed.
An unexpected error occurred: 'The JSON value could not be converted to k8s.Models.V1ServiceStatus. Path: $.status | LineNumber: 0 | BytePositionInLine: 67.'

If I try again, it works as expected.

Mention the platform you are using
VS Code v1.72.2
Extension v1.0.120221031
MacOS 13.0

To Reproduce
Steps to reproduce the behavior:

  1. Run and Debug
  2. Click on Start Debugging for a predefined launch configuration for B2K
  3. Put in your credentials when prompted
  4. See error

Expected behavior
Debugging works the first time, without need to try again after first attempt fails.

Additional context

Stacktrace from MindaroCli logs:

ServiceConnectCommand.ExecuteInnerAsync caught exception System.Text.Json.JsonException: The JSON value could not be converted to k8s.Models.V1ServiceStatus. Path: $.status | LineNumber: 0 | BytePositionInLine: 67.\n at System.Text.Json.ThrowHelper.ThrowJsonException_DeserializeUnableToConvertValue(Type propertyType)\n at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)\n at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)\n at System.Text.Json.Serialization.Metadata.JsonPropertyInfo1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)\n at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)\n at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)\n at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)\n at System.Text.Json.JsonSerializer.ReadCore[TValue](JsonConverter jsonConverter, Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)\n at System.Text.Json.JsonSerializer.ReadCore[TValue](JsonReaderState& readerState, Boolean isFinalBlock, ReadOnlySpan1 buffer, JsonSerializerOptions options, ReadStack& state, JsonConverter converterBase)\n at System.Text.Json.JsonSerializer.ContinueDeserialize[TValue](ReadBufferState& bufferState, JsonReaderState& jsonReaderState, ReadStack& readStack, JsonConverter converter, JsonSerializerOptions options)\n at System.Text.Json.JsonSerializer.ReadAll[TValue](Stream utf8Json, JsonTypeInfo jsonTypeInfo)\n at System.Text.Json.JsonSerializer.ReadAllUsingOptions[TValue](Stream utf8Json, Type returnType, JsonSerializerOptions options)\n at System.Text.Json.JsonSerializer.Deserialize[TValue](Stream utf8Json, JsonSerializerOptions options)\n at k8s.KubernetesJson.Deserialize[TValue](Stream json)\n at k8s.Kubernetes.CreateResultAsync[T](HttpRequestMessage httpRequest, HttpResponseMessage httpResponse, Nullable1 watch, CancellationToken cancellationToken)\n at k8s.AbstractKubernetes.DeleteNamespacedServiceWithHttpMessagesAsync(String name, String namespaceParameter, V1DeleteOptions body, String dryRun, Nullable1 gracePeriodSeconds, Nullable1 orphanDependents, String propagationPolicy, Nullable1 pretty, IReadOnlyDictionary2 customHeaders, CancellationToken cancellationToken)\n at k8s.KubernetesExtensions.DeleteNamespacedServiceAsync(IBasicKubernetes operations, String name, String namespaceParameter, V1DeleteOptions body, String dryRun, Nullable1 gracePeriodSeconds, Nullable1 orphanDependents, String propagationPolicy, Nullable1 pretty, CancellationToken cancellationToken)\n at Microsoft.BridgeToKubernetes.Common.Kubernetes.KubernetesClient.<>c__DisplayClass39_0.<<CreateOrReplaceV1ServiceAsync>b__0>d.MoveNext()\n--- End of stack trace from previous location where exception was thrown ---\n at Microsoft.BridgeToKubernetes.Common.Kubernetes.KubernetesClient.<>c__DisplayClass75_01.<b__0>d.MoveNext()\n--- End of stack trace from previous location where exception was thrown ---\n at Microsoft.BridgeToKubernetes.Common.Utilities.WebUtilities.RetryUntilTimeAsync(Func2 action, TimeSpan maxWaitTime, CancellationToken cancellationToken)\n at Microsoft.BridgeToKubernetes.Common.Kubernetes.KubernetesClient.ClientInvokeWrapperAsync[T](Func1 handler, String operation, CancellationToken cancellationToken)\n at Microsoft.BridgeToKubernetes.Common.Kubernetes.KubernetesClient.CreateOrReplaceV1ServiceAsync(String namespaceName, V1Service service, CancellationToken cancellationToken)\n at Microsoft.BridgeToKubernetes.Library.ManagementClients.RoutingManagementClient.<>c__DisplayClass11_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.RoutingManagementClient.DeployRoutingManagerAsync(CancellationToken cancellationToken)\n at Microsoft.BridgeToKubernetes.Exe.Commands.Connect.ConnectCommand.ExecuteInnerAsync(IConnectManagementClient connectManagementClient, Action workloadStartedHandler, CancellationToken cancellationToken, IRoutingManagementClient routingManagementClient)

and

Logging handled exception: System.Text.Json.JsonException: {"ClassName":"System.Text.Json.JsonException","Message":"The JSON value could not be converted to k8s.Models.V1ServiceStatus.","Data":null,"InnerException":null,"HelpURL":null,"StackTraceString":" at System.Text.Json.ThrowHelper.ThrowJsonException_DeserializeUnableToConvertValue(Type propertyType)\n at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)\n at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)\n at System.Text.Json.Serialization.Metadata.JsonPropertyInfo1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)\n at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)\n at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)\n at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)\n at System.Text.Json.JsonSerializer.ReadCore[TValue](JsonConverter jsonConverter, Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)\n at System.Text.Json.JsonSerializer.ReadCore[TValue](JsonReaderState& readerState, Boolean isFinalBlock, ReadOnlySpan1 buffer, JsonSerializerOptions options, ReadStack& state, JsonConverter converterBase)\n at System.Text.Json.JsonSerializer.ContinueDeserialize[TValue](ReadBufferState& bufferState, JsonReaderState& jsonReaderState, ReadStack& readStack, JsonConverter converter, JsonSerializerOptions options)\n at System.Text.Json.JsonSerializer.ReadAll[TValue](Stream utf8Json, JsonTypeInfo jsonTypeInfo)\n at System.Text.Json.JsonSerializer.ReadAllUsingOptions[TValue](Stream utf8Json, Type returnType, JsonSerializerOptions options)\n at System.Text.Json.JsonSerializer.Deserialize[TValue](Stream utf8Json, JsonSerializerOptions options)\n at k8s.KubernetesJson.Deserialize[TValue](Stream json)\n at k8s.Kubernetes.CreateResultAsync[T](HttpRequestMessage httpRequest, HttpResponseMessage httpResponse, Nullable1 watch, CancellationToken cancellationToken)\n at k8s.AbstractKubernetes.DeleteNamespacedServiceWithHttpMessagesAsync(String name, String namespaceParameter, V1DeleteOptions body, String dryRun, Nullable1 gracePeriodSeconds, Nullable1 orphanDependents, String propagationPolicy, Nullable1 pretty, IReadOnlyDictionary2 customHeaders, CancellationToken cancellationToken)\n at k8s.KubernetesExtensions.DeleteNamespacedServiceAsync(IBasicKubernetes operations, String name, String namespaceParameter, V1DeleteOptions body, String dryRun, Nullable1 gracePeriodSeconds, Nullable1 orphanDependents, String propagationPolicy, Nullable1 pretty, CancellationToken cancellationToken)\n at Microsoft.BridgeToKubernetes.Common.Kubernetes.KubernetesClient.<>c__DisplayClass39_0.<<CreateOrReplaceV1ServiceAsync>b__0>d.MoveNext()\n--- End of stack trace from previous location where exception was thrown ---\n at Microsoft.BridgeToKubernetes.Common.Kubernetes.KubernetesClient.<>c__DisplayClass75_01.<b__0>d.MoveNext()\n--- End of stack trace from previous location where exception was thrown ---\n at Microsoft.BridgeToKubernetes.Common.Utilities.WebUtilities.RetryUntilTimeAsync(Func2 action, TimeSpan maxWaitTime, CancellationToken cancellationToken)\n at Microsoft.BridgeToKubernetes.Common.Kubernetes.KubernetesClient.ClientInvokeWrapperAsync[T](Func1 handler, String operation, CancellationToken cancellationToken)\n at Microsoft.BridgeToKubernetes.Common.Kubernetes.KubernetesClient.CreateOrReplaceV1ServiceAsync(String namespaceName, V1Service service, CancellationToken cancellationToken)\n at Microsoft.BridgeToKubernetes.Library.ManagementClients.RoutingManagementClient.<>c__DisplayClass11_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.RoutingManagementClient.DeployRoutingManagerAsync(CancellationToken cancellationToken)\n at Microsoft.BridgeToKubernetes.Exe.Commands.Connect.ConnectCommand.ExecuteInnerAsync(IConnectManagementClient connectManagementClient, Action workloadStartedHandler, CancellationToken cancellationToken, IRoutingManagementClient routingManagementClient)\n at Microsoft.BridgeToKubernetes.Exe.Commands.Connect.ConnectCommand.ExecuteInnerAsync(IConnectManagementClient connectManagementClient, Action 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":-2146233088,"Source":"System.Text.Json","WatsonBuckets":null,"LineNumber":0,"BytePositionInLine":67,"Path":"$.status","ActualMessage":"The JSON value could not be converted to k8s.Models.V1ServiceStatus. Path: $.status | LineNumber: 0 | BytePositionInLine: 67."}
2022-11-06T08:33:35.4283620Z | MindaroCli | TRACE | Event: Command.End {"properties":{"arguments":"connect --service controlplane-external --env /var/folders/19/mk67cjtd32gbvlqdv0k_t_v40000gn/t/tmp-63295avqm1lro1o3p.env --script /var/folders/19/mk67cjtd32gbvlqdv0k_t_v40000gn/t/tmp-63295avqm1lro1o3p.env.cmd --control-port 51747 --ppid 9376 --namespace dev --elevation-requests [{"requesttype":"edithostsfile"}] --routing arkadiya --local-port 5100","result":"Failed","failureReason":"The JSON value could not be converted to k8s.Models.V1ServiceStatus. Path: $.status | LineNumber: 0 | BytePositionInLine: 67."},"metrics":{"duration":58411.0}}

Installation script - Windows scenario: Reverify the aspnetcore-runtime-3.1 existence for choco.

Describe the bug

For the new installation script for windows O/S the choco packager tries to install aspnetcore-runtime-3.1 which is not there

The correct package it seems is following: https://community.chocolatey.org/packages/dotnetcore-3.1-aspnetruntime

fyi and cc: @hsubramanianaks for verification please. 🦤 🚢

Mention the platform you are using

  • Windows O/S
$ cmd /c ver
Microsoft Windows [Version 10.0.22621.674]
(c) Microsoft Corporation. All rights reserved.

To Reproduce
Steps to reproduce the behavior:

  1. wsl or git bash and then run:
  2. curl -fsSL https://raw.githubusercontent.com/Azure/Bridge-To-Kubernetes/main/scripts/install.sh | bash

Expected behavior
The script should run successfully

Screenshots
If applicable, add screenshots to help explain your problem.

image

image

Unable to connect to TKE (Tencent Kubernetes Engine) cluster using VS2022 plugin

Describe the bug
Hi, I am getting started with Tutorial and I use the deployment & code example in https://github.com/Microsoft/mindaro. I have configued to the service, allowed the EndpointManager to run in Elevation. But every time it ends up with a dialog: "

Mention the platform you are using
Mention what platform you are using (oss, vscode) and pick the corresponding label.
Visual Studio Professional 2022 Preview (17.4.0 Preview 1.0) with Bridge to Kubernetes 2022 (3.0.20220912.3) on Windows 10 Pro 21H2

To Reproduce
Steps to reproduce the behavior:

Step 1: Install the Plugin, download the code on the disk and make cluster ready.

Step 2: Click "Bridge to Kubernetes" and Connecting to service

Step 3: Elevation Require

Step 4: Error is shown: 'Cannot establish the Connection to Cluster'

Expected behavior
I can access to the cluster to debug in it.

Screenshots
If applicable, add screenshots to help explain your problem.

Connecting to service

Elevation Require

(Cannot establish the Connection to Cluster)
image

Failed to perform action on the cluster using the current kubeconfig

Describe the bug
I constantly run into the following error when trying to Debug tunnel to a service on k8s

An unexpected error occurred: 'Failed to perform action on the cluster using the current kubeconfig. You may need to log in by running a kubectl command.'

Mention the platform you are using
Mention what platform you are using (oss, vscode) and pick the corresponding label.

Kubernets version: v1.21.6

Vscode

Version: 1.73.1 (Universal)
Commit: 6261075646f055b99068d3688932416f2346dd3b
Date: 2022-11-09T02:08:38.961Z
Electron: 19.0.17
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Darwin arm64 21.5.0
Sandboxed: No

Extensions

  • Bridge to Kubernetes: v1.0.120221031
  • Kubernetes: v1.3.11
    To Reproduce
    Steps to reproduce the behavior:
  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.
Diagnostic information (Modified senstive information to CAPS)

2022-11-17T05:05:38.2000510Z | MindaroCli | TRACE | Event: Command.Start <json>{"properties":{"arguments":"connect --service <SERVICE-NAME> --env /tmp/tmp-654ezlbqzo52skf.env --script /tmp/tmp-654ezlbqzo52skf.env.cmd --control-port 56886 --ppid 495 --namespace <NAMESPACE> --use-kubernetes-service-environment-variables --local-port 8000","isRoutingEnabled":"false"},"metrics":null}</json>\nOperation context: <json>{"clientRequestId":null,"correlationId":"b91d4be5-f0df-4d91-923b-e1d47b0b699d1668660673366:92e9aa6798df","requestId":null,"userSubscriptionId":null,"startTime":"2022-11-17T05:05:36.5279511Z","userAgent":"VSCode/1.0.120221031","requestHttpMethod":null,"requestUri":null,"version":"1.0.20220816.2","requestHeaders":{},"loggingProperties":{"applicationName":"MindaroCli","deviceOperatingSystem":"Linux 5.10.124-linuxkit #1 SMP PREEMPT Thu Jun 30 08:18:26 UTC 2022","framework":".NET Core 3.1.6","macAddressHash":"<HASH>","processId":7049,"targetEnvironment":"Production","commandId":"92e9aa6798df"}}</json>
2022-11-17T05:05:38.6068205Z | curl -fsSL https://raw.githubusercontent.com/Azure/Bridge-To-Kubernetes/main/scripts/install.sh | bash | TRACE | Running Microsoft.BridgeToKubernetes.Exe.Commands.Connect.ConnectCommand...\nOperation context: <json>{"clientRequestId":null,"correlationId":"b91d4be5-f0df-4d91-923b-e1d47b0b699d1668660673366:92e9aa6798df","requestId":null,"userSubscriptionId":null,"startTime":"2022-11-17T05:05:36.5279511Z","userAgent":"VSCode/1.0.120221031","requestHttpMethod":null,"requestUri":null,"version":"1.0.20220816.2","requestHeaders":{},"loggingProperties":{"applicationName":"MindaroCli","deviceOperatingSystem":"Linux 5.10.124-linuxkit #1 SMP PREEMPT Thu Jun 30 08:18:26 UTC 2022","framework":".NET Core 3.1.6","macAddressHash":"<HASH>","processId":7049,"targetEnvironment":"Production","commandId":"92e9aa6798df","targetServiceName":"<SERVICE-NAME>","isRoutingEnabled":false}}</json>
2022-11-17T05:05:41.2332336Z | MindaroCli | ERROR | Dependency: Service Run - Port Forward <json>{"target":null,"success":false,"duration":null,"properties":{"requestId":"null","clientRequestId":"null","correlationRequestId":"null"}}</json>
2022-11-17T05:05:41.2580236Z | MindaroCli | ERROR | An unexpected error occurred: 'Failed to perform action on the cluster using the current kubeconfig. You may need to log in by running a kubectl command.'\n
2022-11-17T05:05:41.2644711Z | MindaroCli | ERROR | To see our active issues or file a bug report, please visit https://aka.ms/bridge-to-k8s-report.\n
2022-11-17T05:05:41.2673942Z | MindaroCli | ERROR | For diagnostic information, see logs at '/tmp/Bridge To Kubernetes'.\n
2022-11-17T05:05:41.3230155Z | MindaroCli | ERROR | Logging handled exception: System.InvalidOperationException: {"ClassName":"System.InvalidOperationException","Message":"Failed to perform action on the cluster using the current kubeconfig. You may need to log in by running a kubectl command.","Data":null,"InnerException":null,"HelpURL":null,"StackTraceString":"   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":-2146233079,"Source":"dsc","WatsonBuckets":null}
2022-11-17T05:05:41.3411164Z | MindaroCli | TRACE | Event: Command.End <json>{"properties":{"arguments":"connect --service <SERVICE-NAME> --env /tmp/tmp-654ezlbqzo52skf.env --script /tmp/tmp-654ezlbqzo52skf.env.cmd --control-port 56886 --ppid 495 --namespace <NAMESPACE> --use-kubernetes-service-environment-variables --local-port 8000","result":"Failed","failureReason":"Failed to perform action on the cluster using the current kubeconfig. You may need to log in by running a kubectl command."},"metrics":{"duration":3619.0}}</json>

The JSON value could not be converted to k8s.Models.V1ServiceStatus

Describe the bug
Bridge to Kubernetes sometimes fails with error: "An unexpected error occurred: 'The JSON value could not be converted to k8s.Models.V1ServiceStatus". Restarting VSCode will help and fix this issue. From metrics this started happening around August 07th.

Mention the platform you are using
All (Linux, Windows, Mac). VSCode.

To Reproduce
It happens sporadically when you start debugging using bridge.

Expected behavior
This error should not happen.

Can't access services with enabled Microsoft Defender on Mac M1

Describe the bug
Can't use bridge to kubernetes with enabled MS Defender - not able to call services(using dns/direct ip)

Mention the platform you are using
macOS, VSCode.

To Reproduce
Steps to reproduce the issue:

  1. Enable Microsoft Defender on MAC M1
  2. Run Bridge to kubernetes
  3. Try to access any service forwarded from remote cluster, eg:
    Service 'frontend' is available on 127.1.1.4:8000
curl 'http://frontend:8000/path'
curl: (52) Empty reply from server

curl 'http://127.1.1.4:8000/path'
curl: (52) Empty reply from server

after removing MS Defender I'm able to request service

Expected behavior
MS Defender doesn't affect Bridge to kubernetes, or there is a way to add an exception which mitigates the problem

Desktop (please complete the following information):

  • macOS Monterey 12.5.1

Additional info:

Mitigation attempts:

  • Tried to exclude EndpointManager and dsc processes and the whole binaries folder in Defender - didn't help
  • Tried to run dsc as root - didn't help either

Result of investigation:

  • /etc/hosts contains necessary records
  • dsc is listening on the right ip/ports
  • EndpointManager successfully enables port forwarding
  • Didn't find anything suspicious in logs: bridge-endpointmanager-.txt, bridge-mindarocli-.txt, bridge-library-.txt(ready to provide f logs by request)
    -Tried to call service directly: 127.1.1.4:8000, 127.1.1.4:55062 - no luck
    -When click "Disconnect from current session" in VSCode have an exception: Disconnecting from cluster failed: Error: socket hang up

Managed to debug DSC locally, noticed that when Defender is enabled channel created here almost immediately closed. ` So, it looks like defender cut Port forwarding between DSC and Agent in the cluster

Isolation with Nginx Ingress not work anymore!!

referring to issue:
microsoft/mindaro#342

Describe the bug
if you configure it for isolation, it ignore the service that is being debugging --- simply redirect all the request to the main deployments

You cannot debug anymore... simply, in the hosts file will write also the service that needs to be redirect to local...

To Reproduce

simply configure it for isolation and try to debug

Expected behavior
needs to stop on brekpoint in local service

Logs
there's no error , is the behavior the problmem , it ignores the isolation

Environment Details
Client used (VS Code/Visual Studio):
1.70.1
6d9b74a70ca9c7733b29f0456fd8195364076dda
x64
Client's version:
[email protected]
Operating System:
5.18.16-1-MANJARO
Additional context
we are very sad...

I've recreated the cluster from scratch, behavior remains the same :( very sad..

This is critically blocking for us..

Please check the fix, isolation not work anynore, B2K ingore aliasing totally

regards

Bridge to kubernetes for a DAPR microservice

Hello.,

I'm debugging my microservices backend inside minikube successfully using Bridge-to-Kubernetes. This backend is build using dapr. Each microservice invoke the other ones using a sidecar container in the same pod, which takes care of the communication between microservices.

I reach a trouble in debug with bridge to kubernetes, relative to dapr sidecar. I cannot launch dapr service invocation from my app using dapr sidecar, because it cannot found it at default port (3500).

Because of the execution moves to VS Code when using Bridge-to-Kubernetes, this sidecar is not accessible from this other debugging environment.

So, my question is the following: Do you how how can I make this call between my service-app and its dapr-sidecar, in this debugging environment?

Thanks in advance!
Joan Miquel

Run Bridge to K8s as part of GitHub pull request

Hi
Our team has the policy to run all the integration tests against the microservice as part of the GitHub pull request to be confident that no regression issues appear and new features are covered with the integration tests. Since integration tests are running each time when PR is created/updated in GitHub it is hard to deploy the new instance of the same microservice side-by-side with the existing ones. Still, it makes it isolated from the existing ones.

I suspect that Bridge To K8s can help with that since it allows to create and run of a single separate instance (single POD) when debugging service from VSCode or VisualStudio but I haven't found any real examples of how to do that automatically e.g. when the code is pushed to the GH branch and pull request is created.

All microservices are HTTP ones (WebAPI) and based on .NET 6 and are running in the Docker Linux containers in Azure K8s services (all nodes are Linux ones)
We keep containers in the Azure Container Registry

It would be helpful for me to have the example (not the theoretical one but closer to the real working one)
how to do the following using Bridge to K8s having the container already deployed in ACR and the Helm chart for microservice
- deploy container as the single POD service to Azure K8s from the GitHub pull request workflow using Bridge to K8s and get back the unique URL of this service

Currently, we have separate Deployment/Service definitions for testing purposes that deploy a single POD service and get back its unique (short-time living) URL but it requires additional effort from the team.

Thank you in advance

UPD:
Found this Workflow for Bikes sample APP
mindaro - bikes.yml

Still cannot figure out where is the "magic" happens in the workflow file :(

What should I do in order to have the "routing.visualstudio.io" appear in the AKS cluster?
Is it enough to install the routningmanager.yaml ?
Sorry for the TL text but I need brief guidance regarding the B2K incorporation into the GitHub Workflow
Assuming that

  • I already have the "MyService1" already deployed to the AKS test environment and exposed as e.g. "my-service.abcd12345.westeurope.aksapp.io"
  • I need a new single pod service instance to be deployed to the same AKS cluster from the code in GitHub pull request and live side-by-side with the existing service and have a new ingress URL "my-pr123-service.abcd12345.westeurope.aksapp.io" so I can access this URL in PR GH workflow and run integration tests from the Postmain against this new URL. When all tests passed I need to clean up the service from AKS.

B2K Fails to restore service after debugging VSCode

Describe the bug
I run B2K from VSCode launch and useKubernetesServiceEnvironmentVariables is set to false. I can debug successfully but when terminating the debug session I always receive the message "Failed to restore service at 'k8sdev/csprepo-9b9d5bf78-trz4m/csprepo'."
The original pod is never restored, the new pod/job remains. This forces me to tear down my deployment and re-deploy every time.
You can see in the logs the RestoreWorkloadAsync fails, with "Unprocessable Entity: Deployment.apps "csprepo" is invalid:" error.

Mention the platform you are using
VSCode

Expected behavior
Expect the restore job to execute and restore original deployment.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Ubuntu 20.04
  • Version B2K extension v1.0.120220915

Additional context
Running k3s locally, requires the use of the endpoint manager to do dns host file resolution.
logs.txt

Bridge to kubernetes stopped working after VS2022 upgrade to 17.3.0

Describe the bug
Since upgrading Visual Studio 2022 to version 17.3.0 I am unable to debug using the bridge to kubernetes extension.
While the debugging session will keep running in visual studio itself, it seems that everything on the cluster itself shuts down so none of the requests are routed to the local session anymore.

To Reproduce

Upgrade Visual Studio 2022 to version 17.3.0
Try to debug any service on a kubernetes cluster

Logs
bridge-library-2022-08-19-14-42-02-76.txt
bridge-mindarocli-2022-08-19-14-42-01-76.txt
bridge-endpointmanager-2022-08-19-14-42-12-12920.txt
bridge-endpointmanagerlauncher-2022-08-19-14-42-12-1184.txt

Environment Details
Visual Studio: 17.3.0
Bridge to Kubernetes extension: 3.0.20220308.1
Operating System: Windows 10 Pro 21H1 19043.1826

In VS Code everything still works as expected.

"Refresh not supported"

If you start debuging a pod from within Visual Studio 2022 using the regular "Debug start", you will received this error if you hav not yet run any kubectl commands in a command window.

image

To get around this I need to run "kubectl get pods" in a command window so the token gets refreshed,
The VS extension should refresh the token in the background if needed.

NullReferenceException when service doesn't have any backing deployments/pods.

Describe the bug
NullReferenceException when service doesn't have any backing deployments/pods.

Mention the platform you are using
VSCode

To Reproduce

  1. Create a kubernetes service without any pods. For example, a selector that doesn't match any pods.
  2. Start bridge in VS Code

Expected behavior
Bride should work, throws the following instead:

2022-10-21T17:37:03.3030407Z | 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, IEnumerable1 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__DisplayClass19_0.<<GetElevationRequestsAsync>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](Func1 func, FailureConfig failureConfig)","RemoteStackTraceString":null,"RemoteStackIndex":0,"ExceptionMethod":null,"HResult":-2147467261,"Source":"Microsoft.BridgeToKubernetes.Library","WatsonBuckets":null}

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser Brave
  • Version: 1.4, Chromium 106

App debug - connect/disconnect - multiple entries warning related to bridge

I have been using bridge for little while and running/debugging an app - connecting/disconnecting and refreshing K8 real cluster

I see following warnings now

Warning: spec.template.spec.containers[0].env[5].name: duplicate name "BRIDGE_COLLECT_TELEMETRY"
Warning: spec.template.spec.containers[0].env[6].name: duplicate name "BRIDGE_COLLECT_TELEMETRY"
Warning: spec.template.spec.containers[0].env[7].name: duplicate name "BRIDGE_COLLECT_TELEMETRY"
Warning: spec.template.spec.containers[0].env[8].name: duplicate name "BRIDGE_COLLECT_TELEMETRY"
Warning: spec.template.spec.containers[0].env[9].name: duplicate name "BRIDGE_COLLECT_TELEMETRY"
Warning: spec.template.spec.containers[0].env[11].name: duplicate name "CONSOLE_VERBOSITY"
Warning: spec.template.spec.containers[0].env[12].name: duplicate name "CONSOLE_VERBOSITY"
Warning: spec.template.spec.containers[0].env[13].name: duplicate name "CONSOLE_VERBOSITY"
Warning: spec.template.spec.containers[0].env[14].name: duplicate name "CONSOLE_VERBOSITY"
Warning: spec.template.spec.containers[0].env[15].name: duplicate name "CONSOLE_VERBOSITY"
Warning: spec.template.spec.containers[0].env[17].name: duplicate name "BRIDGE_CORRELATION_ID"
Warning: spec.template.spec.containers[0].env[18].name: duplicate name "BRIDGE_CORRELATION_ID"
Warning: spec.template.spec.containers[0].env[19].name: duplicate name "BRIDGE_CORRELATION_ID"
Warning: spec.template.spec.containers[0].env[20].name: duplicate name "BRIDGE_CORRELATION_ID"
Warning: spec.template.spec.containers[0].env[21].name: duplicate name "BRIDGE_CORRELATION_ID"

etc.

indeed I can see in workload YAML these are duplicated...

AM I correct in saying this is bridge failing to clean up after itself?

Missing environment variables for services with multiple ports

Describe the bug

My bridge is configured with "useKubernetesServiceEnvironmentVariables": true. and I have a service that exposes two ports.

Ports are forwarded to "random" port on local machine and variables are exposed in the form <service_name>_SERVICE_<port>_PORT.

There is no way for me to know the name of the variable before I start the bridge.

Mention the platform you are using
I use vscode and cluster is configured in Google Cloud.

To Reproduce
Steps to reproduce the behavior:

  1. deploy service with multiple ports, let say it is named TEST, with ports A=8080 and B=9090
  2. Configure bridge in vscode without local launch cofiguration
  3. set "useKubernetesServiceEnvironmentVariables": true in tasks.json
  4. connect to cluster
  5. in the Bridge Menu, select Show connection diagnostics information
  6. check if there is a variable TEST_SERVICE_PORT_A or TEST_SERVICE_PORT_B (there are not set)

Expected behavior
Environment variables should be named <service_name>SERVICE_PORT<port_name>

Desktop (please complete the following information):

  • OS: Ubuntu 20.04
  • Browser chrome
  • Version 106.0.5249.61 (Official Build) (64-bit)

Dotnet 6 Upgrade - EndpointManager Launch fails in Windows

Describe the bug
Using the PR for dotnet 6 upgrade, EndpointManager Launch fails in Windows

Mention the platform you are using
Windows 11

To Reproduce
Steps to reproduce the behavior:

  1. Install dotnet 6 upgrade VSIX and configure B2k via command palette
  2. Start Debug session via B2K
  3. EndpointManager will fail to start
    2022-11-10T13:48:31.7129684Z | Library | TRACE | EndpointManager is not running: 'A socket operation encountered a dead network.'
    SocketErrorCode is 10050 which is NetworkDown

More Details:
EndpointManager Uses Systems.Net.Sockets to edit hostfiles, allocate IPs, free ports etc..

Expected behavior
EndpointManager should start succesfully.

Screenshots
N/A

Desktop (please complete the following information):

  • OS: Only Windows

How can I configure Bridge to NOT forward certain services' ports?

Hello,

How can I configure Bridge to NOT forward certain services' ports?

I have a smb server on my cluster and I am trying to debug another app that does not depend on it. Bridge tries to allocate port 445 on my local machine and errors out because this port is already in use (I'm on windows, port 445 is in use by default). How can I tell the Bridge to just ignore the smb service and don't perform any forwards?

CLI support for Bridge

Bridge To Kubernetes can be used as a standalone CLI tool since many customers want this feature

  • Download bridge via CURL will be one of the easy and best options.
  • Download bridge stable version, this can be done via following command curl -LO $(curl -L -s https://aka.ms/bridge-lks | jq -r '.linux.url')
  • Download a particular version for linux operating system, this can be also done via CURL curl -LO https://bridgetokubernetes.azureedge.net/zip/<version>/lpk-<arch>.zip
  • write a shell script and power shell script to download them so it will be easier for the user to just run this script.
  • Update the public documentation for this which gives more adoption towards this tool.
  • Update the help menu for the CLI tool
    @elenavillamil @Tatsinnit @gambtho @qpetraroia @sabbour your thoughts please.

Fix Installation script - file installation strategy.

Describe the bug

  • Currently, the installation script whole log of dotnet and other kind of files directly in to the bin ls /usr/local/bin possibly due to this function: copy_b2k_files https://github.com/Azure/Bridge-To-Kubernetes/blob/main/scripts/install.sh#L188

  • It not only clusters but also noticed that it tries to over-write the bin dir kubetcl, there is minor thing I also notice is this in OSX which is to do with some folder structure it is trying to make.

Screenshot 2022-10-28 at 1 42 17 PM

Mention the platform you are using

Screenshot 2022-10-28 at 1 46 18 PM

To Reproduce
Steps to reproduce the behavior:

Run the installer using curl:

     curl -fsSL https://raw.githubusercontent.com/Azure/Bridge-To-Kubernetes/main/scripts/install.sh | bash

Expected behavior
Cleaner install strategy.

Some comments here: #72 (comment)

Thanks heaps, @hsubramanianaks, thanks @teejaded for noticing ❤️☕️.

Ubuntu 22.04 - Failed to update dependencies: No usable version of libssl was found

Describe the bug
Unable to proceed with installing dependencies for the Bridge to Kubernetes extension for Visual Studio Code, hence I'm blocked from configuring the extension to connect to my Kubernetes cluster. Seems to be related to https://forum.unity.com/threads/workaround-for-libssl-issue-on-ubuntu-22-04.1271405/

Mention the platform you are using
Visual Studio Code extension running on WSL2 and Ubuntu 22.04.

To Reproduce
Steps to reproduce the behavior:

  1. Install the extension on Visual Studio Code
  2. Follow the tutorial to create a namespace for the app and deploy it,
  3. Run npm install
  4. Open the Command Palette and run Bridge to Kubernetes: Configure
  5. There is a missing dependency on "libssl". Running "Retry Dependency Update" doesn't fix the problem.

Expected behavior
Proceed to select the Kubernetes service to redirect.

Screenshots

This action requires dependencies that are not available yet. Please look at the "Kubernetes" item in the status bar for more information.
Failed to update dependencies: No usable version of libssl was found

Additional context
See this issue: microsoft/mindaro#327
Ubuntu 22.04 (via WSL): has OpenSSL 3 installed by default

openssl version -v
OpenSSL 3.0.2 15 Mar 2022 (Library: OpenSSL 3.0.2 15 Mar 2022)

Looks like Bridge to Kubernetes is build using .NET Standard 2.1 which only supports older versions of OpenSSL. .NET 5 requires OpenSSL 1.x. Newer distro versions such as Ubuntu 22.04 use OpenSSL 3 and not OpenSSL 1.x (see https://github.com/dotnet/core/blob/main/release-notes/5.0/5.0-supported-os.md)

So, Bridge will need to be rebuilt using .NET 6+ to support a newer distro that only offers OpenSSL 3, or another workaround to install OpenSSL 1.x will need to be provided (see dotnet/core#4749 (comment))

Multiple "proxy" pods running, blocking a new debug session

Using Visual Studio Professional 2021 with latest extension.

If you stop your debug session and then start it while your previous pod is being restored by the "restore" pod, you sometimes ends up with two "proxy" pods running, both theese pod keeps craching and the only way to fix this is to deploy you original pod from scratch.

I think I have figured out what is happening and how to fix this.
The problem seems to be that sometimes a "proxy" pod is created that tries to proxy the already existing proxy pod.

How to fix this:
If you try to start debugging when there are two pods running, you will get a error message from the extension, telling you that "... is currently backed by two pods. Please try again later".

If this code were to look at the tags set on thoose pods, it would see that both pods are "proxy" pods, created by B2K. It could then just remove both theese pods and restore the original pod, before trying to setup a new debug session.

It's easy to reproduce so let me know if you need any logs.

Add support for Mac M1 Arm64

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Mention what platform you want to support the new feature
Mention what platform you would like the feature request to live in (oss, vscode) and select the proper label.

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Running BTK without elevated privileges on local machine

At my company, Developers have to request local admin on their machines and these requests get reviewed. Unfortunately this is a barrier to using BTK.

If a User has write privileges to the HOSTS file, would they still need to be local admins?

Is there an alternative to the local admin requirement? I saw "Environment variables in source code" in https://learn.microsoft.com/en-us/visualstudio/bridge/kubernetes-environment-variables but in our case the Service is being invoked from an Ingress.

Thank you.

Visual Studio 2022 + VSCode plugins running in Amazon Workspaces

Hi,

I'm trying to use Bridge to Kubernetes on Amazon Workspaces. I am able to setup Visual Studio, configure the cluster, connect to the cluster and select the service. However, when I try to click the Debug button -> Bridge to Kubernetes, it starts connecting to the cluster:

bridge-to-kubernetes-2

Following this, I get the following error message:

Unable to create a Unix Domain Socket. If you are running Bridge to Kubernetes on a version of Windows older than Windows 10 Version 1803 (10.0.17134), please consider upgrading your system.

Same issue occurs when trying to use VSCode

Amazon Workspaces, Windows Server 2016

Debug Pod from Kuberentes extension integration fails

Version information
VSIX build number: 120220915
Platform: Windows, Mac and Linux
Cluster region: East US
Kubernetes version: 1.22.11
VS Code version: 1.64.0-insider

Steps to reproduce:

Follow [test readme] (https://github.com/Azure/Bridge-To-Kubernetes/blob/main/tests/manual/BridgeToKubernetes.md#k8s-integration) step 13 in that linked section is the one failing.

  1. Setup todo-app sample application (see instruction)

  2. Debug the pod.
    image

  3. Fails with error:
    image

Clenup job fails on cluster with Linux node taints or clusters created using Rancher

Rancher is a popular tool for cluster management used by many companies but unfortunately, Bridge for Kubernetes doesn't work correctly in that cluster environment.

Steps to reproduce:

  1. Create any cluster using the Rancher tool or assign taints to all Linux nodes inside a non-rancher cluster e.g.
    cattle.io/os=linux:NoSchedule. BTW there is no way to remove taints from Linux nodes created using Rancher
  2. Deploy any Linux hosted app to the cluster specifying toleration in the deployment e.g.
    tolerations:
    - key: cattle.io/os
    operator: Equal
    value: linux
    effect: NoSchedule
  3. Configure and Launch bridge for Kubernetes using VS Code or VS Studio 2022 for the app using the default setup. Observe job activity in the selected namespace.

Actual result:
The pod restore job is stuck in a pending state. There is no official way on how to add tolerations to that job resulting in deployment being in an unusable state after stopping Bridge for Kubernetes
image

Expected result
It should be possible to have some control over job scheduling in order to add tolerations or node selectors. or job should autodetect those things

Traffic via tunnel does not reach to pod in Windows10 vscode

Describe the bug
In Windows10 box, when setting up Bridge to Kubenetes is finished, tunnels to pods are created.
But connection is time out.

Mention the platform you are using
vscode

To Reproduce
Steps to reproduce the behavior:
Trying python app sample: https://microsoft.github.io/AzureTipsAndTricks/blog/tip365.html

  1. '3. Click on the Run and Debug configuration "Python: Current File with Kubernetes". '
  2. wait setup is completed and execute python debugger automatically.
  3. An error is occurred, "Failed to connect to Redis"

Expected behavior
Succecssfully connect to backend redis server

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows10 21H1
  • Browser: no browser
  • Version: VS Code v1.70.2 - Extension v1.0.120220817

Additional context
After setup is completed, tunnels is maked, and connections is accepted, but no response. (port 6379 is redis's)

$ netstat -an | grep 127.1.1.
  TCP         127.1.1.1:6379         0.0.0.0:0              LISTENING
  TCP         127.1.1.2:80           0.0.0.0:0              LISTENING

But no response

$ redic-cli -h 127.1.1.1
127.1.1.1:6389> INFO
(No response...)

Envoy pods no longer apply `kubernetes-route-as` header via ingress route from routingmanager:20220811.1

Describe the bug
Since the image routingmanager:20220811.1 (routingmanager:20220803.1 works) was released the ConfigMap for envoy pods no longer applies the kubernetes-route-as header when accessing a b2k pod through an ingress route. Setting the header manually (e.g. via postman request) still works as expected.

Note, we have two ingress per api. ConfigMaps below have been sanitized to remove identifying information.

Working envoy ConfigMap from routingmanager:20220803.1:

static_resources:
  listeners:
  - name: listener_80_80
    address:
      socket_address:
        address: 0.0.0.0
        port_value: 80
    listener_filters:
    - name: envoy.filters.listener.http_inspector
    filter_chains:
    - filter_chain_match:
        application_protocols:
        - http/1.0
        - http/1.1
        - h2c
      filters:
      - name: envoy.http_connection_manager
        typed_config:
          '@type': type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
          codec_type: auto
          stat_prefix: listener_80_80
          route_config:
            name: listener_80_80_route
            virtual_hosts:
            - name: listener_80_80_route_ingress_withDomain_b2ktest.apiname.sub2.company.net
              domains:
              - b2ktest.apiname.sub2.company.net
              routes:
              - match:
                  prefix: /
                route:
                  cluster: service_debug_withHeader_kubernetes-route-as_b2ktest_80_80
                  timeout: 0s
                  idle_timeout: 0s
                request_headers_to_add:
                - header:
                    key: kubernetes-route-as
                    value: b2ktest
                  append: false
            - name: listener_80_80_route_ingress_withDomain_b2ktest.apiname.sub1.company.net
              domains:
              - b2ktest.apiname.sub1.company.net
              routes:
              - match:
                  prefix: /
                route:
                  cluster: service_debug_withHeader_kubernetes-route-as_b2ktest_80_80
                  timeout: 0s
                  idle_timeout: 0s
                request_headers_to_add:
                - header:
                    key: kubernetes-route-as
                    value: b2ktest
                  append: false
            - name: listener_80_80_route_default
              domains:
              - '*'
              routes:
              - match:
                  headers:
                  - name: kubernetes-route-as
                    exact_match: b2ktest
                  prefix: /
                route:
                  cluster: service_debug_withHeader_kubernetes-route-as_b2ktest_80_80
                  timeout: 0s
                  idle_timeout: 0s
              - match:
                  prefix: /
                route:
                  cluster: service_original_clone_80_80
                  timeout: 0s
                  idle_timeout: 0s
          http_filters:
          - name: envoy.filters.http.router
  clusters:
  - name: service_original_clone_80_80
    connect_timeout: 1.00s
    type: strict_dns
    load_assignment:
      cluster_name: service_original_clone_80_80
      endpoints:
      - lb_endpoints:
        - endpoint:
            address:
              socket_address:
                address: apireleasename-cloned-routing-svc.apireleasename
                port_value: 80
    http_protocol_options: {}
  - name: service_debug_withHeader_kubernetes-route-as_b2ktest_80_80
    connect_timeout: 1.00s
    type: static
    load_assignment:
      cluster_name: service_debug_withHeader_kubernetes-route-as_b2ktest_80_80
      endpoints:
      - lb_endpoints:
        - endpoint:
            address:
              socket_address:
                address: 10.240.1.253
                port_value: 80
    http_protocol_options: {}
admin:
  access_log_path: /tmp/admin_access.log

Non-working envoy ConfigMap from routingmanager:20220811.1, note the missing section per ingress under virtual_hosts for the ingress routes:

  static_resources:
  listeners:
  - name: listener_80_80
    address:
      socket_address:
        address: 0.0.0.0
        port_value: 80
    listener_filters:
    - name: envoy.filters.listener.http_inspector
    filter_chains:
    - filter_chain_match:
        application_protocols:
        - http/1.0
        - http/1.1
        - h2c
      filters:
      - name: envoy.http_connection_manager
        typed_config:
          '@type': type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
          codec_type: auto
          stat_prefix: listener_80_80
          route_config:
            name: listener_80_80_route
            virtual_hosts:
            - name: listener_80_80_route_default
              domains:
              - '*'
              routes:
              - match:
                  headers:
                  - name: kubernetes-route-as
                    exact_match: b2ktest
                  prefix: /
                route:
                  cluster: service_debug_withHeader_kubernetes-route-as_b2ktest_80_80
                  timeout: 0s
                  idle_timeout: 0s
              - match:
                  prefix: /
                route:
                  cluster: service_original_clone_80_80
                  timeout: 0s
                  idle_timeout: 0s
          http_filters:
          - name: envoy.filters.http.router
  clusters:
  - name: service_original_clone_80_80
    connect_timeout: 1.00s
    type: strict_dns
    load_assignment:
      cluster_name: service_original_clone_80_80
      endpoints:
      - lb_endpoints:
        - endpoint:
            address:
              socket_address:
                address: apireleasename-cloned-routing-svc.apireleasename
                port_value: 80
    http_protocol_options: {}
  - name: service_debug_withHeader_kubernetes-route-as_b2ktest_80_80
    connect_timeout: 1.00s
    type: static
    load_assignment:
      cluster_name: service_debug_withHeader_kubernetes-route-as_b2ktest_80_80
      endpoints:
      - lb_endpoints:
        - endpoint:
            address:
              socket_address:
                address: 10.240.1.253
                port_value: 80
    http_protocol_options: {}
admin:
  access_log_path: /tmp/admin_access.log

Mention the platform you are using
Helm deployments via azure devops to spin up temporary test environments

To Reproduce
Set up two namespaces with routingmanager deployed, an api and an ingress. Use version routingmanager:20220811.1 and 20220803.1. Make a request to isolated subdomain and note traffic goes to normal pod, not b2k pod.

Expected behavior
kubernetes-route-as header should be applied by envoy pods to any request that hits the isolated subdomain

Screenshots
image

Additional context
Redacted output from kubectl get ingress for one of the affected ingress routes

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    meta.helm.sh/release-name: apireleasename
    meta.helm.sh/release-namespace: apireleasename
  creationTimestamp: "2022-04-21T16:24:11Z"
  generation: 1
  labels:
    app: apireleasename
    app.kubernetes.io/managed-by: Helm
    chart: apireleasename-0.1.0
    heritage: Helm
    release: apireleasename
  name: apireleasename
  namespace: apireleasename
  resourceVersion: "138231846"
  uid: a18a6e6f-280b-4d82-8460-398c81642a25
spec:
  ingressClassName: nginx
  rules:
  - host: api.sub2.company.net
    http:
      paths:
      - backend:
          service:
            name: apireleasename
            port:
              number: 80
        path: /
        pathType: Prefix
  tls:
  - hosts:
    - apiname.sub2.company.net
    secretName: wildcard-sub2-review-apps-cert
status:
  loadBalancer:
    ingress:
    - ip: <redacted>

Unable to connect to EKS cluster using VS2022 plugin

Describe the bug
VS2022 B2K plugin is unable to read kubeconfig file for EKS.

Mention the platform you are using
VS2022
B2K 3.0.20220912.3

To Reproduce
Steps to reproduce the behavior:

  1. Install extension
  2. Switch to B2K launch profile
  3. Launch debugger or open debug properties -> Edit profile for Bridge To Kubernetes
  4. See error "Failed to load current kubeconfig. This could be due to a typo in your kubeconfig or to an unsupported configuration. ..."

Expected behavior
B2K reads kubeconfig properly

Additional context

I've tried with both the default EKS connection setup (using kubeconfig exec config to create token on demand) and hardcoded bearer as shown below. Both work without issue for kubectl and other apps.

kubeconfig

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: LS0t<redacted>
    server: https://<redacted>.gr7.us-east-1.eks.amazonaws.com
  name: arn:aws:eks:us-east-1:<redacted>:cluster/<redacted>
contexts:
- context:
    cluster: arn:aws:eks:us-east-1:<redacted>:cluster/<redacted>
    namespace: argocd
    user: arn:aws:eks:us-east-1:<redacted>:cluster/<redacted>
  name: arn:aws:eks:us-east-1:<redacted>:cluster/<redacted>
current-context: arn:aws:eks:us-east-1:<redacted>:cluster/<redacted>
kind: Config
preferences: {}
users:
- name: arn:aws:eks:us-east-1:<redacted>:cluster/<redacted>
  user:
    token: k8s-aws-v1.aHR<redacted>

microsoft/mindaro#129
microsoft/mindaro#126

Support debugging multiple services in Visual Studio 2022

Is your feature request related to a problem? Please describe.
No, the request is not related to a problem. It is rather a usability/developer experience issue.

Mention what platform you want to support the new feature
Visual Studio 2022
Our setup uses a local K8s installation (minikube); all our services are hosted there and we use BTK8s for development/debugging

Describe the solution you'd like
We would like to be able to debug multiple services simultaneously with BTK8s in a single VS2022 instance (much like the docker-compose debug experience offered in VS2022)

Describe alternatives you've considered
We can debug multiple services with BTK8s if we use one VS2022 instance for each service. However this is not a robust solution

Support Intellij and others

Is your feature request related to a problem? Please describe.
Can't use Bridge to Kubernetes when using Rider or other tools by Intellij. This was a request from the old repo

Mention what platform you want to support the new feature
Intellij (Rider) across all supported platforms.

Describe the solution you'd like
Parity with the VS Code and VS.net versions

Describe alternatives you've considered
There aren't any.

Support Dev Containers

Is your feature request related to a problem? Please describe.
Right now it's my understanding from the previous repo that BtK doesn't support devcontainers in vs code. Since this is the ideal place to be using these because we can configure dev containers that are identical to the production code (save having the SDK installed for the dev tool) versus having dev code running on windows while k8s is running in linux etc. This needs to be a priority to make this tool truly useful.

Mention what platform you want to support the new feature
All platforms that DevContainers works with.

Describe the solution you'd like
Transparent support for Devcontainers

Describe alternatives you've considered
Native.

Deploy RoutingManager to K8S without using Visual Studio extension

I want to deploy RoutingManager without installing and running the VisualStudio Bridge2Kubernetes extension.

I use AKS to host microservices and rely on the Routing manager that is auto-provisioned by the VS extension but I don't want to install VS B2K extension and run it each time I set up a new K8S namespace.

Before I deployed RoutingManager from the OLD B2K repo https://github.com/microsoft/mindaro/blob/master/routingmanager.yml
but since it uses a Docker image with old code that does not work in K8s anymore I have to use VS extension to provision it.

The new Bridge-To-Kubernetes repo does not have routingmanager.yml file or at least I could not find it there.

Could you please share with me how I can find the YAML file with RoutingManager K8S resources?

If no RoutingManager YAML file exists how can I use parts of the VS extension - e.g. EndpointManager.exe, Bridge.exe, or any other part of VS extension running in the terminal to deploy the RoutingManager service?

Thank you in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.