Failed to get contexts
See original GitHub issueExpected behaviour
When I open the GitOps Tools extension I expect it to use the current context from my kubeconfig. It’s always worked that way in the past.
Actual behaviour
Instead, I get a message saying “Failed to get contexts: Config fetched, but contexts not found.”
Steps to reproduce
Open code from a WSL command line. Select the GitOps Toolkit extension.
Versions
kubectl client v1.25.0 kubectl server v1.22.9+vmware.1 Flux: v0.32.0 Git: 2.25.1 Azure: 2.40.0 Azure extension “k8s-configuration”: not installed Azure extension “k8s-extension”: not installed VSCode: 1.72.0 Extension: 0.22.0 OS: Linux x64 5.15.57.1-microsoft-standard-WSL2
Issue Analytics
- State:
- Created a year ago
- Comments:10
Top Results From Across the Web
"failed to get context" error against real server, works fine with ...
Following the ODATA V4 tutorial in step 2: app runs against mockserver, tips are given to run it against a real server. Used...
Read more >sap.ui.model.odata.v4.Context.failed() : Promise - missing #1499
OpenUI5 version: 1.46.7. I'm trying to create an entity by using OData v4 with the following command: // oContext is my ODataListBinding.
Read more >Failed to return attached pipeline contexts - Codefresh
Solution. 1) Create a dummy shared context with the same name as the missing context from the error message. 2) This dummy context...
Read more >delete on sap.ui.mode.odata.v4.Context is failing with error ...
Hi William,. If your context not begin fetched yet, you can't delete directly. That means you need to call requestObject method to get...
Read more >"Cancelled : error="Failed to get plan from instance for context ...
Description. While executing the flow designer via mid server, throwing the error as 'Failed to get plan from instance for context: 8d0fe27475b114108e4bbabd33 ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

First, it’s not just a WSL problem. If I open VS Code from PowerShell and the Windows desktop, I get the same behavior. I made a short video of starting VS Code from WSL then going to the GitOps extension. You can find it at https://clipchamp.com/watch/gDzBy58oP1l.
Second, my settings.json, regardless of where I open VS Code from, is the same and doesn’t have a
vs-kubernetes.knownKubeconfigs. It only has avs-kubernetes.kubeconfig.My WSL kubeconfig (/home/ken/.kube/config):
My Windows kubeconfig (C:\Users\KenRider.kube\config):
In regards to the localhost:8080 question, it must not be using my default kubeconfig or the kubeconfig referenced in settings.json as both have valid contexts.
That worked. My settings.json now has the vs-kubernetes.kubeconfig and vs-kubernetes.knownKubeconfigs. I had to add both the WSL and the Windows default kubeconfig. However, I do get the same error message when I switch between the two. I must then use the Set Kubeconfig widget again.
{
}
From: Kingdon Barrett @.> Sent: Sunday, November 20, 2022 4:43 AM To: weaveworks/vscode-gitops-tools @.> Cc: Ken Rider @.>; Mention @.> Subject: Re: [weaveworks/vscode-gitops-tools] Failed to get contexts (Issue #393)
OK, my best guess right now is that something fails when the extension sets your KUBECONFIG.
Can you please try one more thing? Using this widget, could you point the extension at a Kubeconfig you want it to use: https://user-images.githubusercontent.com/3286998/202899984-7789c03e-d9db-4b1c-a39e-732ce24cfa97.png
This should result in a “known kubeconfigs” section being added to your settings.json – if you have set a kubeconfig there and it still does not connect from end to end, then we know for sure the problem is somewhere between the extension and the kubectl binary (and not just a matter of KUBECONFIG somehow not being passed in properly to the editor’s context)
— Reply to this email directly, view it on GitHub https://github.com/weaveworks/vscode-gitops-tools/issues/393#issuecomment-1321109847 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AC3EFK5UDBSR73CUT3WHFXLWJIFCVANCNFSM6AAAAAAQ77C2FU . You are receiving this because you were mentioned. https://github.com/notifications/beacon/AC3EFK25QWLXWW4OMMJABY3WJIFCVA5CNFSM6AAAAAAQ77C2FWWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTSOX2EVO.gif Message ID: @.*** @.***> >