microsoft / mindaro

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

Command 'Bridge to Kubernetes: Configure' resulted in an error (Running the contributed command: 'mindaro.configure' failed.) #123

Closed rajserc closed 3 years ago

rajserc commented 3 years ago

Describe the bug Trying to debug app running in pod on an existing cluster shows error "Command 'Bridge to Kubernetes: Configure' resulted in an error (Running the contributed command: 'mindaro.configure' failed.)". This happens after all the four steps are completed.

To Reproduce Steps to follow to reproduce this issue.

Select the kubernetes cluster with correct namespace ctrl+shift P, select Bridge to Kubernetes configure option

  1. from the drop down of available service select the pod that you want to debug
  2. give port details
  3. S elect launch configuration
  4. tried selecting No/Yes for isolation, same error.
**Expected behavior** Application debug should work **Logs** Attach logs from the following directory: For Windows: %TEMP%/Bridge to Kubernetes For OSX/Linux: $TMPDIR/Bridge to Kubernetes If you are a Visual Studio user, please also provide these logs: %temp%\Microsoft.VisualStudio.Kubernetes.Debugging **Environment [Details**](url [bridge-mindarocli-2021-02-23-05-05-59-168676.txt](https://github.com/microsoft/mindaro/files/6026901/bridge-mindarocli-2021-02-23-05-05-59-168676.txt) ) Client used (VS Code/Visual Studio): Client's version: Operating System: **Additional context** Add any other outputs from the clients or context you would like to share.
amsoedal commented 3 years ago

Hi @rajserc, thanks for reporting this issue. Are there any more log files in the %TEMP%/Bridge to Kubernetes directory, e.g. bridge-library-*.txt or bridge-endpointmanager-*.txt? It would also be helpful to get the VSCode logs, which you can find by running "Developer: Open Extension Logs Folder" in the command palette. The bridge logs will be in the folder "mindaro.mindaro". You can email them to BridgeToKubernetes@microsoft.com if you don't feel comfortable uploading them here.

Another thing to check: does it look like the Bridge extension activated correctly? If it did, you should be able to see the "Kubernetes" item in your status bar showing your current namespace & cluster, like this: image If you could please confirm that there isn't a warning triangle or any dependencies in the process of downloading, that would help eliminate some issues.

rajserc commented 3 years ago

Unfortunately i dont see any other file in %TEMP% dir. (win 10 btw).

The kubernetes icon on the bottom does show the namespace correctly and there is no error.

The k8s cluster is rancher with rbac, should i give some permissions ? The pod is a openfaas python fast api function, i guess it doesnt matter.

rakeshvanga commented 3 years ago

Can you share the log file from the Brdige To Kubernetes VS Code extension? You can get the path of the log file from the output window:

Screen Shot 2021-02-23 at 10 11 23 AM

Also what are the versions of Bridge To Kubernetes VS Code extension and Kubernetes VS Code extension?

rajserc commented 3 years ago

There is no output in the output tab.

The only thing i see is "Command 'Bridge to Kubernetes: Configure' resulted in an error (Running the contributed command: 'mindaro.configure' failed.)"

I completely remove the plugin and reinstalled/restarted and tried again and its same issue. Is there some way to enable some more debug/vebosity to file/ui ?

bridge-mindarocli-2021-02-23-20-48-18-211612.txt

rakeshvanga commented 3 years ago

@rajserc Are you sure that you are selecting the Bridge To Kubernetes in the right side top dropdown as highlighted in the below screenshot? image

rajserc commented 3 years ago

btk

I selected BtK in the drop down and the image is attached.

rajserc commented 3 years ago

mindaro-vscode-2021-02-23T21-50-43.593Z-domain.txt I went to the path specified in the output and attached it.

rakeshvanga commented 3 years ago

@rajserc Looking at the logs, everything seems fine.

rajserc commented 3 years ago
  1. Running Bridge to Kuberenetes: Open Menu doesnt show any error, it correctly shows the selected namspace, the pod url and about/report issue. No error in the output.

May be i should try with sample app and try, is there a python sample available ?

Attaching the console log and VS code version info.

console_error1.log

Version: 1.53.2 (user setup) Commit: 622cb03f7e070a9670c94bae1a45d78d7181fbd4 Date: 2021-02-11T11:48:04.245Z Electron: 11.2.1 Chrome: 87.0.4280.141 Node.js: 12.18.3 V8: 8.7.220.31-electron.0 OS: Windows_NT x64 10.0.18363

rakeshvanga commented 3 years ago

@rajserc Thanks for sharing the console logs. It seems like the python extension tht13.python is interfering with Bridge To Kubernetes extension. When the configure command is run Bridge To Kubernetes would update the tasks.json & launch.json files to setup debug profile. When doing this the python extension is interfering with the update process and hence the failure.

We don't have a python sample readily available for you to try out. We can investigate this issue and will update this thread.

Is the python project on which you are trying Bridge To Kubernetes is simple and can be shared with our team? If so you can share the details here or send an email to BridgeToKubernetes@microsoft.com. We can quickly work on it and provide a solution to you.

Thanks!

daniv-msft commented 3 years ago

@rajserc Could you please try to disable/uninstall the tht13.python extension so that we can validate it is the one causing the interference? I agree with @rakeshvanga that it looks related but, trying to install this other extension myself, I couldn't reproduce the issue.

rajserc commented 3 years ago

I deleted the python extension and also removed the extension folder completely and retried.

Command 'Bridge to Kubernetes: Configure' resulted in an error (Running the contributed command: 'mindaro.configure' failed.)

Also, tried removing B2k extension and restarted and tried.

No error in log but still see the same popup error on the right. Command 'Bridge to Kubernetes: Configure' resulted in an error (Running the contributed command: 'mindaro.configure' failed.)

rakeshvanga commented 3 years ago

@rajserc This is very weird. Can you try our sample todo app : https://github.com/microsoft/mindaro/tree/master/samples/todo-app and let us know if it works? I'm trying to understand if this is an issue with Bridge To Kubernetes not able to handle the k8s cluster rancher with rbac.

rajserc commented 3 years ago

i am getting similar to this https://stackoverflow.com/questions/65998115/getting-error-failed-to-load-current-kubeconfig-please-confirm-that-your-kube

Terminal will be reused by tasks, press any key to close it.

Executing task: bridge-to-kubernetes.service <

Redirecting Kubernetes service stats-api to your machine... Target cluster: sandbox Current cluster: sandbox Target namespace: todo-app Current namespace: todo-app Target service name: stats-api Target service ports: 3001 Using kubernetes service environment variables: false

Error: Failed to load current kubeconfig. Please confirm that your kubeconfig is valid.

The terminal process terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

b2k_error

rajserc commented 3 years ago

Not sure how if the kubeconfig file is not valid, it was able to show right namespace and show service and connect to it.

2021-03-05T05:41:18.395Z | Common Extension Root | TRACE | Event: binaries-utility-try-get-binaries-success 2021-03-05T05:41:18.395Z | Common Extension Root | TRACE | Event: connect-service-task-terminal-start-connect {"serviceName":"stats-api","ports":"3001"} 2021-03-05T05:41:18.396Z | Common Extension Root | TRACE | Event: kubectl-client-command {"args":"config view --minify -o json"} 2021-03-05T05:41:18.751Z | Common Extension Root | TRACE | Event: kubectl-client-command-success {"args":"config view --minify -o json"} 2021-03-05T05:41:18.751Z | Common Extension Root | TRACE | Event: binaries-utility-try-get-binaries-success 2021-03-05T05:41:18.751Z | Common Extension Root | TRACE | Event: binaries-utility-try-get-binaries-success 2021-03-05T05:41:18.751Z | Common Extension Root | TRACE | Event: kubectl-client-command {"args":"config view --minify -o json"} 2021-03-05T05:41:19.098Z | Common Extension Root | TRACE | Event: kubectl-client-command-success {"args":"config view --minify -o json"} 2021-03-05T05:41:19.098Z | Connect (stats-api/ebb70 | TRACE | Event: connect-start-connect {"service":"stats-api","ports":"3001","os":"win32"} 2021-03-05T05:41:20.685Z | Common Extension Root | ERROR | Error: cli-client-prep-connect-error Error: Failed to load current kubeconfig. Please confirm that your kubeconfig is valid.\n\n at ChildProcess. (c:\Users\myname.vscode\extensions\mindaro.mindaro-1.0.120210224\dist\extension.js:3:135852)\n at ChildProcess.emit (events.js:315:20)\n at ChildProcess.EventEmitter.emit (domain.js:483:12)\n at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12) 2021-03-05T05:41:20.687Z | Common Extension Root | ERROR | Error: connect-service-task-terminal-error Error: Failed to load current kubeconfig. Please confirm that your kubeconfig is valid.\n\n at ChildProcess. (c:\Users\myname.vscode\extensions\mindaro.mindaro-1.0.120210224\dist\extension.js:3:135852)\n at ChildProcess.emit (events.js:315:20)\n at ChildProcess.EventEmitter.emit (domain.js:483:12)\n at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)

amsoedal commented 3 years ago

@rajserc, sometimes we fail to parse the kubeconfig because of certain fields. Could you please take a look at #111 and #126 to see if either of these fields ("extenstions", or a script to generate user token) is present in your kubeconfig?

rajserc commented 3 years ago

ok, minikube extension in kube config was causing it, after removing that, it seems to be working. I will try to debug python

rajserc commented 3 years ago

still not working for python, any sample setup would be great

amsoedal commented 3 years ago

@rajserc What error message are you getting when you try to debug your python app?

rajserc commented 3 years ago

image

I get this message.

I did try https://github.com/Azure-Samples/azure-voting-app-redis this and it is working. So may be its the app, but im not able to figure out what is wrong. Its a simple app using fastapi with openfaas. I used following launch config.

mindaro-vscode-2021-03-14T04-36-25.449Z.txt

{ "type": "python", "name": "Python Debug with Kubernetes", "request": "launch", "command": "npm run dev", "cwd": "${workspaceFolder}", "preLaunchTask": "bridge-to-kubernetes.service", "env": { "GRPC_DNS_RESOLVER": "native" } }

rakeshvanga commented 3 years ago

@rajserc I see you have closed the issue. Were you able to figure out a way to get Bridge To Kubernetes working for fastapi app?