kubernetes / minikube

Run Kubernetes locally
https://minikube.sigs.k8s.io/
Apache License 2.0
29.22k stars 4.87k forks source link

Hyper-V: unable to find a virtual machine with name "minikube" (unable to recover) #8512

Closed rduda6017 closed 2 years ago

rduda6017 commented 4 years ago

PS C:\WINDOWS\system32> minikube start --vm-driver="hyperv" --hyperv-virtual-switch="MiniKube"

E0618 12:07:16.437003 14304 main.go:106] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V was unable to find a virtual machine with name "minikube". At line:1 char:3

E0618 12:07:17.781791 14304 main.go:106] libmachine: [stderr =====>] : Hyper-V\Stop-VM : Hyper-V was unable to find a virtual machine with name "minikube". At line:1 char:1

E0618 12:07:18.979481 14304 main.go:106] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V was unable to find a virtual machine with name "minikube". At line:1 char:3

E0618 12:07:19.799047 14304 main.go:106] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V was unable to find a virtual machine with name "minikube". At line:1 char:3

E0618 12:07:20.595782 14304 main.go:106] libmachine: [stderr =====>] : Hyper-V\Remove-VM : Hyper-V was unable to find a virtual machine with name "minikube". At line:1 char:1

E0618 12:07:22.451826 14304 main.go:106] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V was unable to find a virtual machine with name "minikube". At line:1 char:3

E0618 12:07:23.352913 14304 main.go:106] libmachine: [stderr =====>] : Hyper-V\Remove-VM : Hyper-V was unable to find a virtual machine with name "minikube". At line:1 char:1

! StartHost failed, but will try again: recreate: creating host: create: creating: exit status 1 E0618 12:07:52.164464 14304 main.go:106] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V was unable to find a virtual machine with name "minikube". At line:1 char:3

E0618 12:07:53.641205 14304 main.go:106] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V was unable to find a virtual machine with name "minikube". At line:1 char:3

E0618 12:07:54.388659 14304 main.go:106] libmachine: [stderr =====>] : Hyper-V\Stop-VM : Hyper-V was unable to find a virtual machine with name "minikube". At line:1 char:1

E0618 12:07:55.118713 14304 main.go:106] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V was unable to find a virtual machine with name "minikube". At line:1 char:3

E0618 12:07:55.855405 14304 main.go:106] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V was unable to find a virtual machine with name "minikube". At line:1 char:3

E0618 12:07:56.626281 14304 main.go:106] libmachine: [stderr =====>] : Hyper-V\Remove-VM : Hyper-V was unable to find a virtual machine with name "minikube". At line:1 char:1

E0618 12:07:58.410256 14304 main.go:106] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V was unable to find a virtual machine with name "minikube". At line:1 char:3

E0618 12:07:59.165425 14304 main.go:106] libmachine: [stderr =====>] : Hyper-V\Remove-VM : Hyper-V was unable to find a virtual machine with name "minikube". At line:1 char:1

tstromberg commented 4 years ago

This seems like buggy behavior on the part of minikube. Do you mind sharing if minikube delete fixes the issue for you?

tstromberg commented 4 years ago

Based on the error message, it seems that something deleted the minikube VM in Hyper-V, but did not use minikube delete. Running the latter should fix it.

markbdsouza commented 4 years ago

Facing the same error.

I ran minikube delete and got the below output

E0626 23:46:55.959179   10552 main.go:106] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V was unable to find a virtual machine with name "minikube".
At line:1 char:3
+ ( Hyper-V\Get-VM minikube ).state
+   ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (minikube:String) [Get-VM], VirtualizationException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.GetVM

* Removing C:\Users\madsouza\.minikube\machines\minikube ...
* Removed all traces of the "minikube" cluster.

I then tried the command minikube start --driver=hyperv

and got a similar stack trace as before

E0626 23:47:50.509014   17184 main.go:106] libmachine: [stderr =====>] : Hyper-V\New-VHD : Win32 internal error "Access is denied" 0x5 occurred while reading the console output buffer. Contact Microsoft Customer Support Services.
At line:1 char:1
+ Hyper-V\New-VHD -Path 'C:\Users\madsouza\.minikube\machines\minikube\ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [New-VHD], VirtualizationException
    + FullyQualifiedErrorId : Unspecified,Microsoft.Vhd.PowerShell.Cmdlets.NewVhd

E0626 23:47:54.107521   17184 main.go:106] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V was unable to find a virtual machine with name "minikube".
At line:1 char:3
+ ( Hyper-V\Get-VM minikube ).state
+   ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (minikube:String) [Get-VM], VirtualizationException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.GetVM

this was followed by the same trace as mentioned initially

martin-schaefer commented 4 years ago

I have the same issue. If I run the command below, the hyperv VM cannot be created or found. Before running the command, I've executed "minikube delete --all --purge" to have a clean start. My guess is that the error happens in the "Convert-VHD" step.

Does anyone know how to come around this?

Log from minikube startup:

PS C:\dev> minikube start -p k8s-showcase --memory='8192mb' --disk-size='16384mb' --vm-driver=hyperv --alsologtostderr -v=9 W0630 14:10:33.811398 16120 root.go:252] Error reading config file at C:\Users\msc.minikube\config\config.json: open C:\Users\msc.minikube\config\config.json: The system cannot find the path specified. I0630 14:10:33.897721 16120 start.go:98] hostinfo: {"hostname":"mynotebook","uptime":22451,"bootTime":1593496582,"procs":262,"os":"windows","platform":"Microsoft Windows 10 Enterprise","platformFamily":"Standalone Work station","platformVersion":"10.0.16299 Build 16299","kernelVersion":"","virtualizationSystem":"","virtualizationRole":"","hostid":"ce2192a6-7145-42aa-9234-f487ba596ff5"} W0630 14:10:33.904622 16120 start.go:106] gopshost.Virtualization returned error: not implemented yet I0630 14:10:33.964635 16120 notify.go:125] Checking for updates... I0630 14:10:33.966620 16120 driver.go:253] Setting default libvirt URI to qemu:///system I0630 14:10:34.970030 16120 start.go:214] selected driver: hyperv I0630 14:10:34.970030 16120 start.go:611] validating driver "hyperv" against I0630 14:10:34.972031 16120 start.go:617] status for hyperv: {Installed:true Healthy:true Error: Fix: Doc:} I0630 14:10:34.981053 16120 start_flags.go:218] no existing cluster config was found, will generate one from the flags I0630 14:10:34.984034 16120 start_flags.go:556] Wait components to verify : map[apiserver:true system_pods:true] I0630 14:10:34.989036 16120 iso.go:118] acquiring lock: {Name:mk68fc927f664690e20e6f52f1baf4ef9e1687fd Clock:{} Delay:500ms Timeout:10m0s Cancel:} I0630 14:10:35.010031 16120 download.go:73] Downloading: https://storage.googleapis.com/minikube/iso/minikube-v1.11.0.iso?checksum=file:https://storage.googleapis.com/minikube/iso/minikube-v1.11.0.iso.sha256 -> C:\Users\msc.minikube\cache\iso\minikube-v1.11.0.iso

minikube-v1.11.0.iso.sha256: 65 B / 65 B [-------------] 100.00% ? p/s 0s minikube-v1.11.0.iso: 174.99 MiB / 174.99 MiB [] 100.00% 7.35 MiB p/s 24s I0630 14:11:00.471212 16120 preload.go:95] Checking if preload exists for k8s version v1.18.3 and runtime docker I0630 14:11:00.599034 16120 preload.go:120] Found remote preload: https://storage.googleapis.com/minikube-preloaded-volume-tarballs/preloaded-images-k8s-v3-v1.18.3-docker-overlay2-amd64.tar.lz4 I0630 14:11:00.601038 16120 cache.go:49] Caching tarball of preloaded images I0630 14:11:00.606039 16120 preload.go:95] Checking if preload exists for k8s version v1.18.3 and runtime docker I0630 14:11:00.740490 16120 preload.go:120] Found remote preload: https://storage.googleapis.com/minikube-preloaded-volume-tarballs/preloaded-images-k8s-v3-v1.18.3-docker-overlay2-amd64.tar.lz4 I0630 14:11:00.747287 16120 download.go:73] Downloading: https://storage.googleapis.com/minikube-preloaded-volume-tarballs/preloaded-images-k8s-v3-v1.18.3-docker-overlay2-amd64.tar.lz4 -> C:\Users\msc.minikube\cache\preloaded-tarball\preloaded-images-k8s-v3-v1.18.3-docker-overlay2-amd64.tar.lz4 preloaded-images-k8s-v3-v1.18.3-docker-overlay2-amd64.tar.lz4: 526.01 MiB I0630 14:12:21.601492 16120 preload.go:158] saving checksum for preloaded-images-k8s-v3-v1.18.3-docker-overlay2-amd64.tar.lz4 ... I0630 14:12:21.802495 16120 preload.go:175] verifying checksumm of C:\Users\msc.minikube\cache\preloaded-tarball\preloaded-images-k8s-v3-v1.18.3-docker-overlay2-amd64.tar.lz4 ... I0630 14:12:22.978806 16120 cache.go:52] Finished verifying existence of preloaded tar for v1.18.3 on docker I0630 14:12:22.979784 16120 profile.go:156] Saving config to C:\Users\msc.minikube\profiles\k8s-showcase\config.json ... I0630 14:12:22.985791 16120 lock.go:35] WriteFile acquiring C:\Users\msc.minikube\profiles\k8s-showcase\config.json: {Name:mk2d7b450dbcbbca101a521fb23dfde926c2c78b Clock:{} Delay:500ms Timeout:1m0s Cancel:} I0630 14:12:22.990783 16120 cache.go:152] Successfully downloaded all kic artifacts I0630 14:12:22.993777 16120 start.go:240] acquiring machines lock for k8s-showcase: {Name:mk4e4056c8844ae69b9a90cc86b7d196c121e60d Clock:{} Delay:500ms Timeout:15m0s Cancel:} I0630 14:12:22.995781 16120 start.go:244] acquired machines lock for "k8s-showcase" in 990.8µs I0630 14:12:22.998784 16120 start.go:84] Provisioning new machine with config: &{Name:k8s-showcase KeepContext:false EmbedCerts:false MinikubeISO:https://storage.googleapis.com/minikube/iso/minikube-v1.11.0.iso KicB aseImage:gcr.io/k8s-minikube/kicbase:v0.0.10@sha256:f58e0c4662bac8a9b5dda7984b185bad8502ade5d9fa364bf2755d636ab51438 Memory:8192 CPUs:2 DiskSize:16384 Driver:hyperv HyperkitVpnKitSock: HyperkitVSockPorts:[] DockerEnv: [] InsecureRegistry:[] RegistryMirror:[] HostOnlyCIDR:192.168.99.1/24 HypervVirtualSwitch: HypervUseExternalSwitch:false HypervExternalAdapter: KVMNetwork:default KVMQemuURI:qemu:///system KVMGPU:false KVMHidden:false DockerOpt:[] DisableDriverMounts:false NFSShare:[] NFSSharesRoot:/nfsshares UUID: NoVTXCheck:false DNSProxy:false HostDNSResolver:true HostOnlyNicType:virtio NatNicType:virtio KubernetesConfig:{KubernetesVersion:v1.18.3 ClusterName:k8s-showcase APIServerName:minikubeCA APIServerNames:[] APIServerIPs:[] DNSDomain:cluster.local ContainerRuntime:docker CRISocket: NetworkPlugin: FeatureGates: ServiceCIDR:10.96.0.0/12 ImageRepository: LoadBalancerStartIP: LoadBalancerEndIP: ExtraOptions:[] ShouldLoadCachedImages:true EnableDefaultCNI:false NodeIP: NodePort:8443 NodeName:} Nodes:[{Name: IP: Port:8443 KubernetesVersion:v1.18.3 ControlPlane:true Worker:true}] Addons:map[] VerifyComponents:map[apiserver:true system_pods:true]} &{Name: IP: Port:8443 KubernetesVersion:v1.18.3 ControlPlane:true Worker:true} I0630 14:12:23.000779 16120 start.go:121] createHost starting for "" (driver="hyperv") I0630 14:12:23.014779 16120 start.go:157] libmachine.API.Create for "k8s-showcase" (driver="hyperv") I0630 14:12:23.014779 16120 client.go:161] LocalClient.Create starting I0630 14:12:23.015783 16120 main.go:110] libmachine: Creating CA: C:\Users\msc.minikube\certs\ca.pem I0630 14:12:23.158784 16120 main.go:110] libmachine: Creating client certificate: C:\Users\msc.minikube\certs\cert.pem I0630 14:12:23.284788 16120 main.go:110] libmachine: [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive @(Get-Module -ListAvailable hyper-v).Name | Get-Unique I0630 14:12:24.220000 16120 main.go:110] libmachine: [stdout =====>] : Hyper-V

I0630 14:12:24.220000 16120 main.go:110] libmachine: [stderr =====>] : I0630 14:12:24.221976 16120 main.go:110] libmachine: [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive @([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(([System.Security.Principal.SecurityIdentifier]::new("S-1-5-32-578"))) I0630 14:12:24.900513 16120 main.go:110] libmachine: [stdout =====>] : True

I0630 14:12:24.900513 16120 main.go:110] libmachine: [stderr =====>] : I0630 14:12:24.902523 16120 main.go:110] libmachine: [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive [Console]::OutputEncoding = [Text.Encoding]::UTF8; ConvertTo-Json @(Hyper-V\Get-VMSwitch|Select Id, Name, SwitchType|Where-Object {($.SwitchType -eq 'External') -or ($.Id -eq 'c08cb7b8-9b3c-408e-8e30-5e16a3aeb444')}|Sort-Object -Property SwitchType) I0630 14:12:26.908991 16120 main.go:110] libmachine: [stdout =====>] : [ { "Id": "c08cb7b8-9b3c-408e-8e30-5e16a3aeb444", "Name": "Default Switch", "SwitchType": 1 } ]

I0630 14:12:26.908991 16120 main.go:110] libmachine: [stderr =====>] : I0630 14:12:26.922008 16120 main.go:110] libmachine: Downloading C:\Users\msc.minikube\cache\boot2docker.iso from file://C:/Users/msc/.minikube/cache/iso/minikube-v1.11.0.iso... I0630 14:12:27.420325 16120 main.go:110] libmachine: Creating SSH key... I0630 14:12:27.594359 16120 main.go:110] libmachine: Creating VM... I0630 14:12:27.594359 16120 main.go:110] libmachine: [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive [Console]::OutputEncoding = [Text.Encoding]::UTF8; ConvertTo-Json @(Hyper-V\Get-VMSwitch|Select Id, Name, SwitchType|Where-Object {($.SwitchType -eq 'External') -or ($.Id -eq 'c08cb7b8-9b3c-408e-8e30-5e16a3aeb444')}|Sort-Object -Property SwitchType) I0630 14:12:29.333568 16120 main.go:110] libmachine: [stdout =====>] : [ { "Id": "c08cb7b8-9b3c-408e-8e30-5e16a3aeb444", "Name": "Default Switch", "SwitchType": 1 } ]

I0630 14:12:29.333568 16120 main.go:110] libmachine: [stderr =====>] : I0630 14:12:29.337564 16120 main.go:110] libmachine: Using switch "Default Switch" I0630 14:12:29.341572 16120 main.go:110] libmachine: [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive @([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator") I0630 14:12:30.077568 16120 main.go:110] libmachine: [stdout =====>] : False

I0630 14:12:30.077568 16120 main.go:110] libmachine: [stderr =====>] : I0630 14:12:30.078578 16120 main.go:110] libmachine: Creating VHD I0630 14:12:30.079570 16120 main.go:110] libmachine: [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Hyper-V\New-VHD -Path 'C:\Users\msc.minikube\machines\k8s-showcase\fixed.vhd' -SizeBytes 16384MB -Fixed I0630 14:12:54.380522 16120 main.go:110] libmachine: [stdout =====>] :

ComputerName : mynotebook Path : C:\Users\msc.minikube\machines\k8s-showcase\fixed.vhd VhdFormat : VHD VhdType : Fixed FileSize : 17179869696 Size : 17179869184 MinimumSize : LogicalSectorSize : 512 PhysicalSectorSize : 512 BlockSize : 0 ParentPath : DiskIdentifier : E7353324-FA69-434E-B3E6-FBDB45AFE9D5 FragmentationPercentage : 0 Alignment : 1 Attached : False DiskNumber : IsPMEMCompatible : False AddressAbstractionType : None Number :

I0630 14:12:54.382527 16120 main.go:110] libmachine: [stderr =====>] : I0630 14:12:54.387522 16120 main.go:110] libmachine: Writing magic tar header I0630 14:12:54.388523 16120 main.go:110] libmachine: Writing SSH key tar header I0630 14:12:54.390524 16120 main.go:110] libmachine: [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Hyper-V\Convert-VHD -Path 'C:\Users\msc.minikube\machines\k8s-showcase\fixed.vhd' -DestinationPath 'C:\Users\msc.minikube\machines\k8s-showcase\disk.vhd' -VHDType Dynamic -DeleteSource I0630 14:13:07.820395 16120 main.go:110] libmachine: [stdout =====>] : I0630 14:13:07.820395 16120 main.go:110] libmachine: [stderr =====>] : I0630 14:13:07.821399 16120 main.go:110] libmachine: [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Hyper-V\New-VM k8s-showcase -Path 'C:\Users\msc.minikube\machines\k8s-showcase' -SwitchName 'Default Switch' -MemoryStartupBytes 8192MB I0630 14:13:09.500442 16120 main.go:110] libmachine: [stdout =====>] : E0630 14:13:09.500442 16120 main.go:106] libmachine: [stderr =====>] : Hyper-V\New-VM : Fehler beim Erstellen des virtuellen Computers. In Zeile:1 Zeichen:1

I0630 14:13:09.505451 16120 client.go:164] LocalClient.Create took 46.4881763s I0630 14:13:11.507049 16120 start.go:124] duration metric: createHost completed in 48.4977047s I0630 14:13:11.507049 16120 start.go:75] releasing machines lock for "k8s-showcase", held for 48.5067085s I0630 14:13:11.509913 16120 main.go:110] libmachine: [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Hyper-V\Get-VM k8s-showcase ).state I0630 14:13:12.879197 16120 main.go:110] libmachine: [stdout =====>] : E0630 14:13:12.879197 16120 main.go:106] libmachine: [stderr =====>] : Hyper-V\Get-VM : Von Hyper-V wurde kein virtueller Computer mit dem Namen "k8s-showcase" gefunden. In Zeile:1 Zeichen:3

W0630 14:13:12.881203 16120 start.go:359] delete host: Docker machine "k8s-showcase" does not exist. Use "docker-machine ls" to list machines. Use "docker-machine create" to add a new one. ...[removed remaining log]

cwegener commented 4 years ago

I'm running into a similar issue during minikube start due to minikube/libmachine not waiting long enough for the Hyper-V VM-disk to be created.

The relevant error in my case is:

! StartHost failed, but will try again: creating host: create host timed out in 240.000000 seconds

I'm not sure where this (somewhat arbitrary) 240 seconds timeout comes from.

Edit: Alright. At least I found where the 4 minute timeout has been hardcoded 5a6ce7331c1dc790bb40725bd996821c77c9076c / 798abeaf1c72268e5a4ed6d9af78626f082e3130

petr-motejlek commented 4 years ago

Hey,

I just got bit by the 240-second timeout too. In my case, there doesn't seem to be any real issue there, apart from the disk size being 128GB and that is just taking too long (longer than 240 seconds). For now, I went with 64 GBs, but was looking for a way to increase the timeout ... too bad, it's hard coded.

I am not sure what exactly is happening. I am running using the HyperV driver on Windows 10 (I would switch to VirtualBox, but I want to retain the ability to use WSL 2 and that does not play well together otherwise...). And the one thing I don't get is why the disk creation takes so long anyway (we are creating an empty disk file here :D; but I guess, it's not a sparse file, but it needs to be filled with 0, so that might be taking some time; then again, I am on an NVMe PCIe3 SSD...). It seems like minikube first asks HyperV to create the disk file (that takes 1-2 minutes), and it then begins to convert the file (not sure that that conversion is actually converting) -- this takes 1-2 minutes also, so it's easy to run into the time out, with bigger drives :(

Having the option to increase the timeout would be so good. Shall I create an issue for that?

sharifelgamal commented 4 years ago

@petr-motejlek Yes, please create a separate feature request issue for being able to specify a timeout. Thanks!

petr-motejlek commented 4 years ago

@sharifelgamal , done :D

https://github.com/kubernetes/minikube/issues/8897

m287867 commented 4 years ago

Any solution found ? i'am still having the same issue !

ehlesp commented 4 years ago

I'm having a similar issue like this one, but I think I've noticed something else so I'd like to share my experience here. First, the technical details:

Platform:

I've installed minikube by using the installer, configured the default driver to be hyperv and then I started minikube in a powershell console with admin rights. This FIRST time ended returning errors similar to the ones reported before:

PS C:\WINDOWS\system32> e:
PS E:\> minikube start
* minikube v1.12.3 en Microsoft Windows 10 Home 10.0.19041 Build 19041
* Using the hyperv driver based on user configuration
* Downloading VM boot image ...
    > minikube-v1.12.2.iso.sha256: 65 B / 65 B [-------------] 100.00% ? p/s 0s
    > minikube-v1.12.2.iso: 173.73 MiB / 173.73 MiB  100.00% 1.07 MiB p/s 2m42s
* Starting control plane node minikube in cluster minikube
* Downloading Kubernetes v1.18.3 preload ...
    > preloaded-images-k8s-v5-v1.18.3-docker-overlay2-amd64.tar.lz4: 510.91 MiB
* Creating hyperv VM (CPUs=2, Memory=4000MB, Disk=20000MB) ...
* Stopping node "minikube"  ...
* Apagando "minikube" mediante SSH...
* Eliminando "minikube" en hyperv...
! StartHost failed, but will try again: creating host: create host timed out in 360.000000 seconds
E0813 12:13:09.101904    2160 main.go:111] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V no pudo encontrar una máquina virtual con el nombre "minikube".
En línea: 1 Carácter: 3
+ ( Hyper-V\Get-VM minikube ).state
+   ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (minikube:String) [Get-VM], VirtualizationException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.GetVM

                                                                                                                        E0813 12:13:10.586857    2160 main.go:111] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V no pudo encontrar una máquina virtual con el nombre "minikube".                                                                               En línea: 1 Carácter: 3                                                                                                 + ( Hyper-V\Get-VM minikube ).state                                                                                     +   ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (minikube:String) [Get-VM], VirtualizationException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.GetVM

                                                                                                                        E0813 12:13:12.059929    2160 main.go:111] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V no pudo encontrar una máquina virtual con el nombre "minikube".                                                                               En línea: 1 Carácter: 3                                                                                                 + ( Hyper-V\Get-VM minikube ).state                                                                                     +   ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (minikube:String) [Get-VM], VirtualizationException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.GetVM

                                                                                                                        E0813 12:13:13.531682    2160 main.go:111] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V no pudo encontrar una máquina virtual con el nombre "minikube".                                                                               En línea: 1 Carácter: 3                                                                                                 + ( Hyper-V\Get-VM minikube ).state                                                                                     +   ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (minikube:String) [Get-VM], VirtualizationException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.GetVM

                                                                                                                        * Creating hyperv VM (CPUs=2, Memory=4000MB, Disk=20000MB) ...                                                          E0813 12:13:15.016613    2160 main.go:111] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V no pudo encontrar una máquina virtual con el nombre "minikube".                                                                               En línea: 1 Carácter: 3                                                                                                 + ( Hyper-V\Get-VM minikube ).state
+   ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (minikube:String) [Get-VM], VirtualizationException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.GetVM

E0813 12:13:16.505829    2160 main.go:111] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V no pudo encontrar una máquina virtual con el nombre "minikube".
En línea: 1 Carácter: 3
+ ( Hyper-V\Get-VM minikube ).state
+   ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (minikube:String) [Get-VM], VirtualizationException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.GetVM

E0813 12:13:17.978156    2160 main.go:111] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V no pudo encontrar una máquina virtual con el nombre "minikube".
En línea: 1 Carácter: 3
+ ( Hyper-V\Get-VM minikube ).state
+   ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (minikube:String) [Get-VM], VirtualizationException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.GetVM

E0813 12:13:19.442683    2160 main.go:111] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V no pudo encontrar una máquina virtual con el nombre "minikube".
En línea: 1 Carácter: 3
+ ( Hyper-V\Get-VM minikube ).state
+   ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (minikube:String) [Get-VM], VirtualizationException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.GetVM

E0813 12:13:20.919570    2160 main.go:111] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V no pudo encontrar una máquina virtual con el nombre "minikube".
En línea: 1 Carácter: 3
+ ( Hyper-V\Get-VM minikube ).state
+   ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (minikube:String) [Get-VM], VirtualizationException                                                                                                                                                                                 + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.GetVM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    * Failed to start hyperv VM. "minikube start" may fix it: creating host: create host timed out in 360.000000 seconds
*
E0813 12:19:13.670942    2160 exit.go:76] &{ID:CREATE_TIMEOUT Err:create host timed out in 360.000000 seconds                                                                                                                                                                  creating host
k8s.io/minikube/pkg/minikube/machine.createHost
        /app/pkg/minikube/machine/start.go:164
k8s.io/minikube/pkg/minikube/machine.StartHost
        /app/pkg/minikube/machine/start.go:86
k8s.io/minikube/pkg/minikube/node.startHost
        /app/pkg/minikube/node/start.go:401
k8s.io/minikube/pkg/minikube/node.startMachine
        /app/pkg/minikube/node/start.go:345
k8s.io/minikube/pkg/minikube/node.Provision
        /app/pkg/minikube/node/start.go:234
k8s.io/minikube/cmd/minikube/cmd.provisionWithDriver
        /app/cmd/minikube/cmd/start.go:275
k8s.io/minikube/cmd/minikube/cmd.runStart
        /app/cmd/minikube/cmd/start.go:169
github.com/spf13/cobra.(*Command).execute
        /go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:846
github.com/spf13/cobra.(*Command).ExecuteC
        /go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:950
github.com/spf13/cobra.(*Command).Execute
        /go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:887
k8s.io/minikube/cmd/minikube/cmd.Execute
        /app/cmd/minikube/cmd/root.go:106
main.main
        /app/cmd/minikube/main.go:71
runtime.main
        /usr/local/go/src/runtime/proc.go:203
runtime.goexit
        /usr/local/go/src/runtime/asm_amd64.s:1373
Failed to start host
k8s.io/minikube/pkg/minikube/node.startMachine
        /app/pkg/minikube/node/start.go:347
k8s.io/minikube/pkg/minikube/node.Provision
        /app/pkg/minikube/node/start.go:234
k8s.io/minikube/cmd/minikube/cmd.provisionWithDriver
        /app/cmd/minikube/cmd/start.go:275
k8s.io/minikube/cmd/minikube/cmd.runStart
        /app/cmd/minikube/cmd/start.go:169
github.com/spf13/cobra.(*Command).execute
        /go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:846
github.com/spf13/cobra.(*Command).ExecuteC
        /go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:950
github.com/spf13/cobra.(*Command).Execute
        /go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:887
k8s.io/minikube/cmd/minikube/cmd.Execute
        /app/cmd/minikube/cmd/root.go:106
main.main
        /app/cmd/minikube/main.go:71
runtime.main
        /usr/local/go/src/runtime/proc.go:203
runtime.goexit
        /usr/local/go/src/runtime/asm_amd64.s:1373

Advice:Try 'minikube delete', and disable any conflicting VPN or firewall software URL: Issues:[7072] ShowIssueLink:false}

* [CREATE_TIMEOUT] error provisioning host Failed to start host: creating host: create host timed out in 360.000000 seconds
* Suggestion: Try 'minikube delete', and disable any conflicting VPN or firewall software
* Related issue: https://github.com/kubernetes/minikube/issues/7072
PS E:\>

BUT the funny thing is that, after supposedly failing to work, the virtual machine had been created and was running: I could see it in the Hyper-V manager. Well, I opted to delete the VM, and the command worked flawlessly:

PS E:\> minikube delete
* Stopping node "minikube"  ...
* Apagando "minikube" mediante SSH...
* Eliminando "minikube" en hyperv...
* Removed all traces of the "minikube" cluster.

Then I decided to start again the minikube, so this is the SECOND attempt:

PS E:\> minikube start
* minikube v1.12.3 en Microsoft Windows 10 Home 10.0.19041 Build 19041
* Using the hyperv driver based on user configuration
* Starting control plane node minikube in cluster minikube
* Creating hyperv VM (CPUs=2, Memory=4000MB, Disk=20000MB) ...

And it stopped showing messages for a little while, then this happened on its own:

* Stopping node "minikube"  ...
* Apagando "minikube" mediante SSH...
* Eliminando "minikube" en hyperv...
! StartHost failed, but will try again: creating host: create host timed out in 360.000000 seconds
E0813 13:12:43.896261    8092 main.go:111] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V no pudo encontrar una máquina virtual con el nombre "minikube".
En línea: 1 Carácter: 3
+ ( Hyper-V\Get-VM minikube ).state                                                                                                                                                                                                                                            +   ~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                                                                                                                                                        + CategoryInfo          : InvalidArgument: (minikube:String) [Get-VM], VirtualizationException                                                                                                                                                                                 + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.GetVM

E0813 13:12:45.365677    8092 main.go:111] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V no pudo encontrar una máquina virtual con el nombre "minikube".
En línea: 1 Carácter: 3
+ ( Hyper-V\Get-VM minikube ).state
+   ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (minikube:String) [Get-VM], VirtualizationException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.GetVM

E0813 13:12:46.838753    8092 main.go:111] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V no pudo encontrar una máquina virtual con el nombre "minikube".                                                                                                              En línea: 1 Carácter: 3                                                                                                                                                                                                                                                        + ( Hyper-V\Get-VM minikube ).state                                                                                                                                                                                                                                            +   ~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                                                                                                                                                        + CategoryInfo          : InvalidArgument: (minikube:String) [Get-VM], VirtualizationException                                                                                                                                                                                 + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.GetVM

E0813 13:12:48.318685    8092 main.go:111] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V no pudo encontrar una máquina virtual con el nombre "minikube".
En línea: 1 Carácter: 3
+ ( Hyper-V\Get-VM minikube ).state
+   ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (minikube:String) [Get-VM], VirtualizationException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.GetVM

* Creating hyperv VM (CPUs=2, Memory=4000MB, Disk=20000MB) ...
E0813 13:12:49.825705    8092 main.go:111] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V no pudo encontrar una máquina virtual con el nombre "minikube".
En línea: 1 Carácter: 3
+ ( Hyper-V\Get-VM minikube ).state
+   ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (minikube:String) [Get-VM], VirtualizationException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.GetVM

E0813 13:12:51.324624    8092 main.go:111] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V no pudo encontrar una máquina virtual con el nombre "minikube".
En línea: 1 Carácter: 3
+ ( Hyper-V\Get-VM minikube ).state
+   ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (minikube:String) [Get-VM], VirtualizationException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.GetVM

E0813 13:12:52.806846    8092 main.go:111] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V no pudo encontrar una máquina virtual con el nombre "minikube".
En línea: 1 Carácter: 3
+ ( Hyper-V\Get-VM minikube ).state
+   ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (minikube:String) [Get-VM], VirtualizationException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.GetVM

E0813 13:12:54.309713    8092 main.go:111] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V no pudo encontrar una máquina virtual con el nombre "minikube".
En línea: 1 Carácter: 3
+ ( Hyper-V\Get-VM minikube ).state
+   ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (minikube:String) [Get-VM], VirtualizationException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.GetVM

E0813 13:12:55.839492    8092 main.go:111] libmachine: [stderr =====>] : Hyper-V\Get-VM : Hyper-V no pudo encontrar una máquina virtual con el nombre "minikube".
En línea: 1 Carácter: 3
+ ( Hyper-V\Get-VM minikube ).state
+   ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (minikube:String) [Get-VM], VirtualizationException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.GetVM

All that happened in the console, meanwhile I noticed in the Hyper-V manager that the minikube virtual machine dissapeared for no known reason only to be recreated again and left running an instant later after being removed. That strange removal seems to be the cause of those Hyper-V was unable to find a virtual machine with name "minikube" errors, but why is this happening is beyond me.

I hope this description helps solving this issue.

cwegener commented 4 years ago

Have you tried using the brand new --wait-timeout flag in 1.12.3?

On Thu, 13 Aug 2020 at 22:44, Eduardo Higueras Ledesma wrote:

I'm having a similar issue like this one, but I think I've noticed something else so I'd like to share my experience here. First, the technical details:

Platform:

  • Windows 10 Home (with spanish localization), version 2004, OS Version 19041.388.

  • Minikube v1.12.3

ehlesp commented 4 years ago

Have you tried using the brand new --wait-timeout flag in 1.12.3?

I wasn't aware of that option, but I've made a test with it. I've started minikube with a 10 minutes wait timeout:

PS E:\> minikube start --wait-timeout 10m0s
* minikube v1.12.3 en Microsoft Windows 10 Home 10.0.19041 Build 19041
* Using the hyperv driver based on user configuration
* Starting control plane node minikube in cluster minikube
* Creating hyperv VM (CPUs=2, Memory=4000MB, Disk=20000MB) ...

And exactly for ten minutes the machine has been running on the Hyper-V. Right after those ten minutes it deleted and recreated itself again (also returning the timeout error). Before those 10 minutes ended I checked the minikube node status:

PS E:\> minikube status
E0813 19:34:07.278719   11164 status.go:297] failed to get driver ip: getting IP: IP not found
E0813 19:34:07.280687   11164 status.go:207] status error: getting IP: IP not found
minikube
type: Control Plane
host: Error
kubelet: Nonexistent
apiserver: Nonexistent
kubeconfig: Nonexistent

My Hyper-V configuration is just by default right now, so maybe there's something missing there, like configuring a proper virtual switch for minikube, although I haven't seen a mention of it in the minikube start guide.

I also tried to connect to the node with the following command:

PS E:\> minikube kubectl -- get po -A
*
X Unable to get forwarded endpoint: failed to parse ip for ""
*
* minikube is exiting due to an error. If the above message is not useful, open an issue:
  - https://github.com/kubernetes/minikube/issues/new/choose

But as you can see, it failed. Not surprising since the node has no IP.

timcruciano commented 4 years ago

I have been having the same issue. I finally found this on stackoverflow to resolve it.
minikube start --kubernetes-version="v1.18.0" --vm-driver="hyperv" --hyperv-virtual-switch="minikube" --v=9

rubenpurple commented 4 years ago

I have been able to fix it by changing the network card of the virtual commuter:

image

mariorojas commented 4 years ago

Thanks @rubenpurple , it worked for me!

mbrijun commented 3 years ago

Same problem here. It seems that the only way around is to create an external virtual switch in Hyper-V.

mbrijun commented 3 years ago

Serveral hours later, the problem has been found. The creation of minikube VM fails because it cannot receive a DHCP lease from the Hyper-V's "Default Switch". That problem in turn was caused by an overly agressive firewall settings on Bitdefender Total Security. I have not found way to fully configure the Bitdefender yet, but simply disabling the firewall within it allows for the DHCP leases to be issued. Minikube now starts correctly on the "Default Switch" without the need to resort to an external switch.

victorgunta commented 3 years ago

I have been able to fix it by changing the network card of the virtual commuter:

image

Worked for me aswell ;)

dineshreddychittamuri commented 3 years ago

in order to eliminate the above error in windows go to users/profile/.minikube and delete it.

context:-profile= username

Re-run the command

lydonchandra commented 3 years ago

Had same issue in Azure VM running Windows Server 2019,

Had to setup DHCP, new Internal Switch and set minikube to use it, now minikube has an ip-address

https://stackoverflow.com/a/65975888/115988

Followed guide here https://docs.microsoft.com/en-us/azure/virtual-machines/windows/nested-virtualization#set-up-internet-connectivity-for-the-guest-virtual-machine

k-weaver commented 3 years ago

I ran into this issue running Windows 10 19042.928. Even on my old Ubuntu VM I had running, it was unable to obtain an IP via DHCP on internal/private or even the default network(s). This worked at one point though, not sure what caused it to break but I'd bet it was probably a windows update of some sort.

I ended up using an existing external Virtual Switch that I had already setup previously. This solved the problem for me as its not using the Hyper-V pre-defined DHCP server (which isn't working for whatever reason) and instead gets an IP from my internal network.

minikube start --hyperv-use-external-switch

sharifelgamal commented 3 years ago

Yes, an external switch is always an option of HyperV users, using the pre-defined one was just a convenience we added into minikube some time ago.

PWaksman commented 3 years ago

I can't make it find the vm, I did tried pointing it to the Hyper-V switch... --force also doesn't help as the -wait-timeout 3m0s.

image

PWaksman commented 3 years ago

managed to run it!

minikube start --wait-timeout 3m0s --hyperv-virtual-switch "HyperV-Internal01"

paired with the physical network card on previous comment, where the HyperV-Internal01 is the name of the switch.

I have been able to fix it by changing the network card of the virtual commuter: image

Worked for me aswell ;)

k8s-triage-robot commented 2 years ago

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot commented 2 years ago

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

You can:

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

klaases commented 2 years ago

Hi @PWaksman, glad to hear that this was able to run!

Closing out for now, please feel free to re-open the issue by commenting with /reopen if needed.

Thank you for sharing your experience with the minikube community!

samygitrepo commented 2 years ago

Hello @rduda6017 and all...

I had same issue. Root cause for me was that I had connected my pc with my company VPN, which disables creating dynamic domain using DHCP.

So, I jus had to disconnect VPN (from anyConnect cisco) and ran below cmd which fixed by issue.

minikube delete --all minikube start --driver=hyperv --force

demuelle commented 2 years ago

I got this error and I don't know the root cause :( (WINDOWS 11 PRO; kubectl v 1.23.5; minikube v 1.26.1) BUT TL;DR I was able to get it running again by creating a new (Internal) virtual switch in Hyper-V Manager, Configuring my internet connection to allow other network users to connect through this computer's Internet connection with the new virtual switch, and then starting minikube with

minikube start --vm-driver="hyperv" --hyperv-virtual-switch="NEWSWITCHNAME" where NEWSWITCHNAME is the name of the virtual switch I created.

Here endeth the TL;DR

I got here by using verbose mode for debugging using --alsologtostderr --v=2 like this:

minikube start --vm-driver="hyperv" --hyperv-virtual-switch="minikube" --alsologtostderr --v=2

And I learned that the minikube container was running, but never got an IP address. The output looked like this I0829 16:19:13.748683 30248 main.go:134] libmachine: [executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (( Hyper-V\Get-VM minikube ).networkadapters[0]).ipaddresses[0] | I0829 16:19:14.861314 30248 main.go:134] libmachine: [stdout =====>] :

So I ran the command that the script was trying to run ( Hyper-V\Get-VM minikube ).networkadapters And I saw that there was no IP Address assigned to minikube

Name            IsManagementOs VMName   SwitchName MacAddress   Status IPAddresses
----            -------------- ------   ---------- ----------   ------ -----------
Network Adapter False          minikube minikube  00BB5DCCCBDD {Ok}   {}

After making the change the output of ( Hyper-V\Get-VM minikube ).networkadapters looked as follows (note there is now an IPAdress):

Name            IsManagementOs VMName   SwitchName MacAddress   Status IPAddresses
----            -------------- ------   ---------- ----------   ------ -----------
Network Adapter False          minikube minikube2  00BB5DCCCBDD {Ok}   {192.168.137.171}

It had worked before. And it works again. But why did it stop working? Oh, well. Moving on.

pmacn commented 1 year ago

Network adapter was my issue too. Had forgotten I had changed my motherboard so that the old adapted was no longer valid.

njibrahim commented 1 year ago

Ensure docker is running before running minikube start

CodeButter96 commented 1 year ago

I had same problem on VS Code powershell with no privileges. Using powershell with administrator privilege worked for me,,

sathish-sign commented 1 year ago

As a Admin user it is perfectly worked for me