Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

There is a problem with the Azure Dev Spaces Tools installation: Missing or invalid kubectl.exe. Please repair/reinstall and try again. #18

Closed
beaubutton opened this issue Aug 17, 2018 · 23 comments

Comments

@beaubutton
Copy link

I can use kubectl from the cli (win 10) just fine, but when I attempt to run the asp.net core 2.1 project using azure dev spaces I get the following error.

Starting warmup for project '#####'.
Waiting for namespace to be provisioned.
An error occurred during warmup for project '#####':
Autofac.Core.DependencyResolutionException: An exception was thrown while executing a resolve operation. See the InnerException for details. ---> AsyncHelpers.Run method threw an exception. (See inner exception for details.) ---> System.AggregateException: AsyncHelpers.Run method threw an exception. ---> Microsoft.Mindaro.Common.Exceptions.KubectlException: There is a problem with the Azure Dev Spaces Tools installation: Missing or invalid kubectl.exe. Please repair/reinstall and try again.
at Microsoft.Mindaro.Common.Utilities.KubectlUtilities.ValidateKubectlCanBeExecuted(ILogUtility log)
at Microsoft.Mindaro.Client.ManagementClients.ServiceManagementClientImplementation.InitializeAsync()
at Autofac.AutofacRegistrationBuilderExtensions.<>c__DisplayClass0_13.<InitializeOnActivation>b__1() at Microsoft.Mindaro.Common.Utilities.AsyncHelpers.<>c__DisplayClass0_0.<<RunSync>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject) --- End of stack trace from previous location where exception was thrown --- at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject) --- End of inner exception stack trace --- at Microsoft.Mindaro.Common.Utilities.AsyncHelpers.ExclusiveSynchronizationContext.BeginMessageLoop() at Microsoft.Mindaro.Common.Utilities.AsyncHelpers.RunSync(Func1 task)
at Autofac.AutofacRegistrationBuilderExtensions.<>c__DisplayClass0_03.<InitializeOnActivation>b__0(IActivatingEventArgs1 e)
at Autofac.Builder.RegistrationBuilder3.<>c__DisplayClass30_0.<OnActivating>b__0(Object s, ActivatingEventArgs1 e)
at Autofac.Core.Registration.ComponentRegistration.RaiseActivating(IComponentContext context, IEnumerable1 parameters, Object& instance) at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters)
at Autofac.Core.Resolving.InstanceLookup.b__5_0()
at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func1 creator) at Autofac.Core.Resolving.InstanceLookup.Execute() at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable1 parameters)
at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable1 parameters) --- End of inner exception stack trace --- at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable1 parameters)
at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable1 parameters) at Autofac.Features.LazyDependencies.LazyRegistrationSource.<>c__DisplayClass5_11.b__1()
at System.Lazy1.CreateValue() at System.Lazy1.LazyInitValue()
at System.Lazy1.get_Value() at Microsoft.Mindaro.Client.ManagementClients.ServiceManagementClient.StartIterationTracking(ServiceIterateOption iterateOption, Func2 getTunnelPortHandler, Action1 portStatusUpdateHandler, IProgress1 progress, CancellationToken cancellationToken)
at Microsoft.VisualStudio.Azure.DevSpaces.Tools.Common.Client.DevSpacesServiceClient.EnsureIterativeSessionInitialized(String projectFilePath, IServiceConfig serviceConfig, String devSpacesConfigName)
at Microsoft.VisualStudio.Azure.DevSpaces.Tools.Common.Client.DevSpacesServiceClient.<>c__DisplayClass26_0.<b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Azure.DevSpaces.Tools.Common.Logging.PerfLoggerExtensions.d__3`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Azure.DevSpaces.Tools.Package.Services.DebugService.d__25.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Azure.DevSpaces.Tools.Package.Services.BackgroundWarmupService.<>c__DisplayClass10_0.<b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Azure.DevSpaces.Tools.Common.Logging.PerfLoggerExtensions.d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Azure.DevSpaces.Tools.Package.Services.BackgroundWarmupService.d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Azure.DevSpaces.Tools.Package.Services.BackgroundWarmupService.<>c__DisplayClass8_0.<b__3>d.MoveNext()
Enabling debugging...

@lisaguthrie
Copy link
Collaborator

Do you have a space in your Windows user name? We recently fixed an issue where users saw this error under that circumstance, but I don't think the fix has made its way into production yet.

If you don't have a space in your user name, let me know so we can troubleshoot further.

@beaubutton
Copy link
Author

Yes ma'am, my username is "Beau Button".

@lisaguthrie
Copy link
Collaborator

@beaubutton the fix will be in an upcoming release of the VS extension. In the meantime, you can use the CLI and/or VS Code, or if you're interested in testing out a private build of the VS extension with the fix in place, please contact me at Lisa.Guthrie@Microsoft.com

@krotkiske
Copy link

I have the same exact issue. when is the next release slated to be released?

@lisaguthrie
Copy link
Collaborator

Good news @beaubutton and @krotkiske - we just pushed an updated version of the extension that fixes this issue. VS should auto-update your version, or you can download from here: https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vs-tools-for-kubernetes

Let me know if you're having any issues after installing the new extension. Thanks for your patience!

@dendle
Copy link

dendle commented Oct 1, 2018

Hello @lisaguthrie,
I have just experienced the same error. I am using the lastest plugin version.

"Microsoft.Mindaro.Common.Exceptions.KubectlException: There is a problem with the Azure Dev Spaces Tools installation: Missing or invalid kubectl.exe. Please repair/reinstall and try again."

kubectl is in my path, and runs fine. I have an AKS cluster on the latest version (RBAC=On), 1.11.2, located in West Europe.

The default dev space appears to have been created OK, with a k8s namespace azds with healthy containers in it.

I get the error when VS2017 boots, and when I try to run a new asp.net core website templated project.

Can anyone help?

Thanks,
Matt

@lisaguthrie
Copy link
Collaborator

Hmmm @dendle, can you enable logging as described here: https://docs.microsoft.com/en-us/azure/dev-spaces/troubleshooting#enabling-detailed-logging

And then look through the log for the kubectl error? Sometimes there is additional error information included in the log that doesn't show up in VS itself.

@a7medit
Copy link

a7medit commented Oct 4, 2018

I have the same issue.

@jorisdebock
Copy link

In what directory is it looking for kubectl.exe? I am also experiencing the same issue and the logs don't give much more info than the above stacktrace.

@lisaguthrie
Copy link
Collaborator

lisaguthrie commented Oct 4, 2018

@Wazowsk1 to find out which path the extension has been installed to, go to C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2017\ENTERPRISE\COMMON7\IDE\EXTENSIONS. From there, do a search for a file named Microsoft.VisualStudio.Azure.DevSpaces.Tools.Common.dll. That’s where the extension is found. From there, you can find the kubectl\win subfolder.

The specific command line we try to run is:
kubectl --cache-dir "C:\Users\[your user name]\.azds\kubectl-http-cache" version --short

@jessebarocio
Copy link

I started receiving this error today as well. It worked this morning. When trying to run the following with kubectl in the extension's installation dir:

kubectl --cache-dir "C:\Users\username\.azds\kubectl-http-cache" version --short

It printed the following error:

error: Error loading config file "C:\Users\username\.kube\config": error converting *[]NamedCluster into *map[string]*api.Cluster: duplicate name "my-cluster" in list: [{docker-for-desktop-cluster {https://localhost:6445 true  [] []}} {my-cluster {https://my-cluster-uid.hcp.westus2.azmk8s.io:443

This did not happen when running the same command using the kubectl in my system path. Wiping out C:\Users\username\.kube\ got me around the issue... for now.

@jorisdebock
Copy link

@lisaguthrie I have run the command manually and did also get the same duplication error as @jessebarocio.

I checked my config in .kube path and it did had 2 times the same context and 2 times the same user which caused the error. I manually removed the duplicated ones and the azre dev spaces extension is now working.

Maybe the extension does not check if the same context/user is already in the config? I did use the "azds" commands before to set up the config and after installing this extension I followed the setup popup.

@lisaguthrie
Copy link
Collaborator

Thanks @jessebarocio and @Wazowsk1 - these details are super helpful! We will look into it. Is this only happening in VS, or does it happen at the CLI as well?

@lisaguthrie
Copy link
Collaborator

Just discussed with the dev team. A fix is in progress and will be out in the next few weeks. In the meantime, the workaround is to delete the .kube folder as @jessebarocio figured out, or to remove the duplicate contexts from the .kube\config file. Sorry for the inconvenience!

@YuzorMa
Copy link
Contributor

YuzorMa commented Oct 26, 2018

@jessebarocio, @Wazowsk1 We've released a new version of the tools (CLI and VS extension) which should address these issues. Please let us know if you continue to see them.

@solstarz
Copy link

@lisaguthrie Hi, im getting this same error but on a mac.
Is there a way to resolve that?

Thanks in advance

@YuzorMa
Copy link
Contributor

YuzorMa commented Dec 11, 2018

@solstarz What version of the azds CLI are you using when you see this error. Can you provide the exact error message and logs (in your temp folder).

@solstarz
Copy link

@YuzorMa

Sorry for the late reply, but i solved it by installing the following:
curl -L https://aka.ms/get-azds-mac | bash.

@YuzorMa YuzorMa closed this as completed Jan 8, 2019
@HaimAudioburst
Copy link

HaimAudioburst commented Feb 13, 2019

I just installed this tool on VS 2017 and noticed that it crashes my other VS solutions that doesn't use Kubernetis.
Other VS solution contains also Service Fabric projects.

I see the following crash error in Windows Event Viewer:

Application: devenv.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.NullReferenceException
at Microsoft.VisualStudio.Azure.DevSpaces.Tools.Package.ProjectSystem.ProjectWarmupLauncher+<StartupProjectListener_OnStartupProjectChanged>d__20.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__6_0(System.Object)
at Microsoft.VisualStudio.Threading.JoinableTaskFactory+SingleExecuteProtector.TryExecute()
at Microsoft.VisualStudio.Threading.JoinableTaskFactory+SingleExecuteProtector+<>c.<.cctor>b__20_0(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)

What can I do?

@mthalman
Copy link

@HaimAudioburst - This is a completely separate issue from the one you've posted this on. Can you log a separate issue so it can be tracked appropriately? Then post back here with a link to your new issue.

@mthalman
Copy link

@HaimAudioburst - We've released a new version of Visual Studio Tools for Kubernetes on the VS Marketplace that should resolve your problem: https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vs-tools-for-kubernetes.

@HaimAudioburst
Copy link

HaimAudioburst commented Feb 25, 2019 via email

@HaimAudioburst
Copy link

@mthalman thanks, new VS tools for kubernetes release doesn't crash now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests