Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hyperv-virtual-switch; startup hangs indefinitely trying to get ip address #2751

Closed
jwgain0 opened this issue Apr 19, 2018 · 21 comments
Closed
Labels
cause/vm-networking Startup failures due to VM networking co/hyperv HyperV related issues kind/bug Categorizes issue or PR as related to a bug. os/windows priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done.

Comments

@jwgain0
Copy link

jwgain0 commented Apr 19, 2018

Minikube Version: 0.26.1
OS: Windows 10 - 1709
VM Driver: hyperv
ISO: minikube-v0.26.0.iso

I am having a similar problem #2425. I am searching through open issues to see if anyone has a work around for my problem. Attempting to use Windows 10/Hyper-v. I have setup a Virtual Switch (external network with Ethernet network adapter). I am using release 0.25.2 to get around #2634. (Update: This morning I updated to 0.26.1)

I run the following command in powershell:
minikube start --vm-driver="hyperv" --memory=4096 --hyperv-virtual-switch="My Virtual Switch" --v=7 --alsologtostderr

The script goes along for while. It successfully creates the minikube VM. But then it gets to a point where it continually polls for the vm's state and ip address. It appears the command to get the network adapter IP address returns nothing. But command to retrieve the state returns "Running". It does this several times until it just hangs indefinitely.

minikubcreateps

If I then open another powershell instance and do kubectl cluster-info, it initially says Kubernetes master is running at http://localhost:8080 but then receives an error stating it couldn't connect to target machine because connection has been actively refused.

kubectlclusterinfo

Update: Minikube ssh does not work. But if I connect to the VM via Hyper-V Manager, I can execute curl command and get a webpage, so it does have network connectivity with my Virtual Switch

@jwgain0 jwgain0 changed the title Minikube startup hands indefinitely trying to get ip address Windows10/hyperv Minikube startup hangs indefinitely trying to get ip address Windows10/hyperv Apr 19, 2018
@jwgain0
Copy link
Author

jwgain0 commented Apr 19, 2018

Posting My Virtual Switch Settings just to ensure they are correct:

virtualswitch

@jwgain0
Copy link
Author

jwgain0 commented Apr 19, 2018

I have figured out that it is something to do with the ps command:
C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (( Hyper-V\Get-VM minikube ).networkadapters[0]).ipaddresses[0]

If I remove the array index identifier from ipaddresses, it will successfully return the array object
C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (( Hyper-V\Get-VM minikube ).networkadapters[0]).ipaddresses
Result
IP address
Mac address

If I tell it to give me the item at index 1 it will give the mac address:
C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (( Hyper-V\Get-VM minikube ).networkadapters[0]).ipaddresses[1]
Result: Mac Address

But giving it the index at 0 the result is an empty string. Very bizarre.

@jwgain0
Copy link
Author

jwgain0 commented Apr 19, 2018

I have a potential solution. If you pass the -Command flag and wrap the command in the quotes you get the expected output

C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive -Command "(( Hyper-V\Get-VM minikube ).networkadapters[0]).ipaddresses[0]"

I could clone the project and change the command and if it works make a pull request. However I haven't seen any instructions on how to build the windows executable.

Would anyone be able to help me with what steps I should take to do this? @gbraad I have seen that you are a collaborator and commented on several issues. What do you think about this issue?

FYI Powershell Version 5.1.16299.251

@jwgain0
Copy link
Author

jwgain0 commented Apr 19, 2018

I cloned the repo and changed the following code in on line 28 of /vendors/docker/machine/drivers/hyperv/powershell.go

Orig:
'args = append([]string{"-NoProfile", "-NonInteractive"}, args...)'

New:
'args = append([]string{"-NoProfile","-NonInteractive", "-Command"}, "\"", args..., "\""
)'

I try to make on a Ubuntu VM and the make fails because it can't find the package "context" referenced in /vendor/k8s.io/apimachinery/pkg/util/wait/wait.go

ubuntumakefail

@jwgain0
Copy link
Author

jwgain0 commented May 10, 2018

Just wanted to Bump this up. I am still experiencing this issue and haven't got any response.

@robbie-demuth
Copy link

I haven't dug as deep as jwgain0, but I seem to be experiencing the same issue. Whenever I run minikube start ... the console cycles through the following output, but the command never completes successfully:

[executing ==>] : C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (( Hyper-V\Get-VM minikube ).networkadapters[0]).ipaddresses[0]
[stdout =====>] :
[stderr =====>] :
[executing ==>] : C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Hyper-V\Get-VM minikube ).state
[stdout =====>] : Running

[stderr =====>] :

@beingamarnath
Copy link

+1, even i'm stuck with the same error

@cwroble
Copy link

cwroble commented Jul 16, 2018

+1 same issue. I am using this cmd:
minikube start --vm-driver=”hyperv” –-hyperv-virtual-switch=”MiniKubeNAT” --cpus=3 --memory=10240

@dejandb
Copy link

dejandb commented Jul 20, 2018

@jwgain0 @beingamarnath @cwroble - I had issues with 0.27 (have yet to try 0.28 or 0.28.1) so ended up downgrading to 0.26.2 and after the initial VM creation I let the script run for a while, stop the script, VM and then change the virtual switch back to a local switch.

Then again run "minikube start" with no arguments and everything works correctly.

Ideally the switch will not be required and just optional as mentioned in the documentation but it is a required argument and the script checks that it is external at VM creation time.

@bartvanhoutte
Copy link

+1

@tstromberg tstromberg added kind/bug Categorizes issue or PR as related to a bug. os/windows co/hyperv HyperV related issues labels Sep 19, 2018
@tstromberg tstromberg changed the title Minikube startup hangs indefinitely trying to get ip address Windows10/hyperv hyperv-virtual-switch; startup hangs indefinitely trying to get ip address Sep 19, 2018
@tstromberg
Copy link
Contributor

@jwgain0 - Do you mind attaching the output of "minikube start -v10" and "minikube logs"? Thanks!

@gbraad
Copy link
Contributor

gbraad commented Sep 19, 2018

Be sure you can be assigned an IP address on an internal or private virtual switch. hyper-v does not provide a dhcp server on these networks, unless you run one yourself, with the exception of the Default Switch(but this has other shortcomings). The external switch bridges a network adapter. So when on Wireless, use the wirless adapter as bridge, and vice versa. The network you attach to has to provide the DHCP server for assigning an address. Be aware, using a VPN can cause issues as they tend to route all, which means the DHCP request will not be received.

@f06ybeast
Copy link

Minikube at Hyper-V should have its own, External, Virtual Switch, based on your main (real) Intel Adapter. Create at PowerShell:

New-VMSwitch –Name "minikube-GbE" –AllowManagement $True –NetAdapterName "THE_NAME_OF_YOUR_Intel_Adapter"

Then, reference that Hyper-V switch at the minikube start command:

minikube start --vm-driver=hyperv --hyperv-virtual-switch=minikube-GbE --v=7 --alsologtostderr

Or, better still, add such to the ~/.minikube/config.json file, e.g.,

"hyperv-virtual-switch": "minikube-GbE",

(I experienced similar error messages when accidentally using an Internal Virtual Switch.)

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 19, 2019
@tstromberg tstromberg added cause/vm-networking Startup failures due to VM networking priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. and removed more-info-needed labels Jan 22, 2019
@nrc73
Copy link

nrc73 commented Jan 27, 2019

+1

OS: Windows 10 - 1803
VM Driver: hyperv
ISO: minikube-v0.33.1.iso

`C:\WINDOWS\system32>minikube start --memory=2048 --vm-driver="hyperv" --hyperv-virtual-switch="external" -v 9999 --logtostderr
W0128 08:37:20.292909 7052 root.go:146] Error reading config file at C:\Users\NC.minikube\config\config.json: open C:\Users\NC.minikube\config\config.json: The system cannot find the file specified.
I0128 08:37:20.294913 7052 notify.go:121] Checking for updates...
I0128 08:37:31.666578 7052 start.go:120] Viper configuration:
Aliases:
map[string]string{}
Override:
map[string]interface {}{"v":"9999"}
PFlags:
map[string]viper.FlagValue{"cpus":viper.pflagValue{flag:(*pflag.Flag)(0xc00031bc20)}, "disk-size":viper.pflagValue{flag:(*pflag.Flag)(0xc00031bcc0)}, "xhyve-disk-driver":viper.pflagValue{flag:(*pflag.Flag)(0xc00031bf40)}, "hyperv-virtual-switch":viper.pflagValue{flag:(*pflag.Flag)(0xc00031be00)}, "nfs-share":viper.pflagValue{flag:(*pflag.Flag)(0xc0004e45a0)}, "service-cluster-ip-range":viper.pflagValue{flag:(*pflag.Flag)(0xc0004e4b40)}, "bootstrapper":viper.pflagValue{flag:(*pflag.Flag)(0xc00031ae60)}, "profile":viper.pflagValue{flag:(*pflag.Flag)(0xc00031adc0)}, "apiserver-names":viper.pflagValue{flag:(*pflag.Flag)(0xc0004e4960)}, "feature-gates":viper.pflagValue{flag:(*pflag.Flag)(0xc0004e5040)}, "hyperkit-vsock-ports":viper.pflagValue{flag:(*pflag.Flag)(0xc0004e5360)}, "vm-driver":viper.pflagValue{flag:(*pflag.Flag)(0xc00031bae0)}, "extra-config":viper.pflagValue{flag:(*pflag.Flag)(0xc0004e5180)}, "insecure-registry":viper.pflagValue{flag:(*pflag.Flag)(0xc0004e4be0)}, "keep-context":viper.pflagValue{flag:(*pflag.Flag)(0xc00031b7c0)}, "mount":viper.pflagValue{flag:(*pflag.Flag)(0xc00031b860)}, "nfs-shares-root":viper.pflagValue{flag:(*pflag.Flag)(0xc0004e4640)}, "uuid":viper.pflagValue{flag:(*pflag.Flag)(0xc0004e5220)}, "apiserver-port":viper.pflagValue{flag:(*pflag.Flag)(0xc0004e4820)}, "cri-socket":viper.pflagValue{flag:(*pflag.Flag)(0xc0004e4dc0)}, "docker-env":viper.pflagValue{flag:(*pflag.Flag)(0xc0004e46e0)}, "host-only-cidr":viper.pflagValue{flag:(*pflag.Flag)(0xc00031bd60)}, "kubernetes-version":viper.pflagValue{flag:(*pflag.Flag)(0xc0004e4e60)}, "cache-images":viper.pflagValue{flag:(*pflag.Flag)(0xc0004e50e0)}, "memory":viper.pflagValue{flag:(*pflag.Flag)(0xc00031bb80)}, "network-plugin":viper.pflagValue{flag:(*pflag.Flag)(0xc0004e4f00)}, "registry-mirror":viper.pflagValue{flag:(*pflag.Flag)(0xc0004e4c80)}, "docker-opt":viper.pflagValue{flag:(*pflag.Flag)(0xc0004e4780)}, "hyperkit-vpnkit-sock":viper.pflagValue{flag:(*pflag.Flag)(0xc0004e52c0)}, "mount-string":viper.pflagValue{flag:(*pflag.Flag)(0xc00031b900)}, "apiserver-name":viper.pflagValue{flag:(*pflag.Flag)(0xc0004e48c0)}, "disable-driver-mounts":viper.pflagValue{flag:(*pflag.Flag)(0xc00031b9a0)}, "enable-default-cni":viper.pflagValue{flag:(*pflag.Flag)(0xc0004e4fa0)}, "gpu":viper.pflagValue{flag:(*pflag.Flag)(0xc0004e5400)}, "kvm-network":viper.pflagValue{flag:(*pflag.Flag)(0xc00031bea0)}, "apiserver-ips":viper.pflagValue{flag:(*pflag.Flag)(0xc0004e4a00)}, "container-runtime":viper.pflagValue{flag:(*pflag.Flag)(0xc0004e4d20)}, "dns-domain":viper.pflagValue{flag:(*pflag.Flag)(0xc0004e4aa0)}, "iso-url":viper.pflagValue{flag:(*pflag.Flag)(0xc00031ba40)}}
Env:
map[string]string{}
Key/Value Store:
map[string]interface {}{}
Config:
map[string]interface {}{}
Defaults:
map[string]interface {}{"wantreporterror":false, "wantreporterrorprompt":true, "showbootstrapperdeprecationnotification":true, "v":"0", "alsologtostderr":"false", "log_dir":"", "wantupdatenotification":true, "reminderwaitperiodinhours":24, "wantkubectldownloadmsg":true, "wantnonedriverwarning":true, "showdriverdeprecationnotification":true}
Starting local Kubernetes v1.13.2 cluster...
Starting VM...
I0128 08:37:31.699589 7052 cluster.go:69] Machine does not exist... provisioning new machine
I0128 08:37:31.701584 7052 cluster.go:70] Provisioning machine with config: {MinikubeISO:https://storage.googleapis.com/minikube/iso/minikube-v0.33.1.iso Memory:2048 CPUs:2 DiskSize:20000 VMDriver:hyperv ContainerRuntime: HyperkitVpnKitSock: HyperkitVSockPorts:[] XhyveDiskDriver:ahci-hd DockerEnv:[] InsecureRegistry:[] RegistryMirror:[] HostOnlyCIDR:192.168.99.1/24 HypervVirtualSwitch:external KvmNetwork:default Downloader:{} DockerOpt:[] DisableDriverMounts:false NFSShare:[] NFSSharesRoot:/nfsshares UUID: GPU:false}
I0128 08:37:31.705591 7052 downloader.go:56] Not caching ISO, using https://storage.googleapis.com/minikube/iso/minikube-v0.33.1.iso
Reading certificate data from C:\Users\NC.minikube\certs\ca.pem
Decoding PEM data...
Parsing certificate...
Reading certificate data from C:\Users\NC.minikube\certs\cert.pem
Decoding PEM data...
Parsing certificate...
[executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive @(Get-Module -ListAvailable hyper-v).Name | Get-Unique
[stdout =====>] : Hyper-V

[stderr =====>] :
[executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive @([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole("S-1-5-32-578")
[stdout =====>] : False

[stderr =====>] :
[executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive @([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
[stdout =====>] : True

[stderr =====>] :
[executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (Hyper-V\Get-VMSwitch).Name
[stdout =====>] : DockerNAT
external
Default Switch

[stderr =====>] :
Downloading C:\Users\NC.minikube\cache\boot2docker.iso from file://C:/Users/NC/.minikube/cache/iso/minikube-v0.33.1.iso...
Creating SSH key...
Creating VM...
[executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (Hyper-V\Get-VMSwitch).Name
[stdout =====>] : DockerNAT
external
Default Switch

[stderr =====>] :
Using switch "external"
[executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive @([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
[stdout =====>] : True

[stderr =====>] :
Creating VHD
[executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Hyper-V\New-VHD -Path 'C:\Users\NC.minikube\machines\minikube\fixed.vhd' -SizeBytes 10MB -Fixed
[stdout =====>] :

ComputerName : LAPTOP-PN3J6I3Q
Path : C:\Users\NC.minikube\machines\minikube\fixed.vhd
VhdFormat : VHD
VhdType : Fixed
FileSize : 10486272
Size : 10485760
MinimumSize :
LogicalSectorSize : 512
PhysicalSectorSize : 512
BlockSize : 0
ParentPath :
DiskIdentifier : 12C83E60-DC6A-4F07-938B-BE7ECA848B0A
FragmentationPercentage : 0
Alignment : 1
Attached : False
DiskNumber :
IsPMEMCompatible : False
AddressAbstractionType : None
Number :

[stderr =====>] :
Writing magic tar header
Writing SSH key tar header
[executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Hyper-V\Convert-VHD -Path 'C:\Users\NC.minikube\machines\minikube\fixed.vhd' -DestinationPath 'C:\Users\NC.minikube\machines\minikube\disk.vhd' -VHDType Dynamic -DeleteSource
[stdout =====>] :
[stderr =====>] :
[executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Hyper-V\Resize-VHD -Path 'C:\Users\NC.minikube\machines\minikube\disk.vhd' -SizeBytes 20000MB
[stdout =====>] :
[stderr =====>] :
[executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Hyper-V\New-VM mi
nikube -Path 'C:\Users\NC.minikube\machines\minikube' -SwitchName 'external' -MemoryStartupBytes 2048MB
[stdout =====>] :
Name State CPUUsage(%) MemoryAssigned(M) Uptime Status Version


minikube Off 0 0 00:00:00 Operating normally 8.3

[stderr =====>] :
[executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Hyper-V\Set-VMProcessor minikube -Count 2
[stdout =====>] :
[stderr =====>] :
[executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Hyper-V\Set-VMDvdDrive -VMName minikube -Path 'C:\Users\NC.minikube\machines\minikube\boot2docker.iso'
[stdout =====>] :
[stderr =====>] :
[executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Hyper-V\Add-VMHardDiskDrive -VMName minikube -Path 'C:\Users\NC.minikube\machines\minikube\disk.vhd'
[stdout =====>] :
[stderr =====>] :
Starting VM...
[executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive Hyper-V\Start-VM minikube
[stdout =====>] :
[stderr =====>] :
Waiting for host to start...
[executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Hyper-V\Get-VM minikube ).state
[stdout =====>] : Running

[stderr =====>] :
[executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (( Hyper-V\Get-VM minikube ).networkadapters[0]).ipaddresses[0]
[stdout =====>] :
[stderr =====>] :
[executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Hyper-V\Get-VM minikube ).state
[stdout =====>] : Running

[stderr =====>] :
[executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive (( Hyper-V\Get-VM minikube ).networkadapters[0]).ipaddresses[0]
[stdout =====>] :
[stderr =====>] :
[executing ==>] : C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive ( Hyper-V\Get-VM minikube ).state`

@dkirrane
Copy link

dkirrane commented Feb 20, 2019

Anyone any update on this?
I hit same issue with the latest minikube version: v0.34.1 with hyperv driver.
I've followed instructions to create external vswitch and rebooted (as per doc )

@Scyldshefing
Copy link

I have also hit this issue - I have applied various proposed fixes - including moving my executables and folders from my D drive to my C drive. Creating various vswitch (I know my vswitch "external" is working as I have a working HYPERV image running an SNMP evaluation on it - and that is reaching out into my wider network).

It is a shame really as I really wanted to get a feel for Kubernetes.

@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Apr 3, 2019
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot
Copy link
Contributor

@AdamDadvar: You can't reopen an issue/PR unless you authored it or you are a collaborator.

In response to this:

/reopen
/remove-lifecycle rotten

+1 - Exact same error with me

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Jun 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cause/vm-networking Startup failures due to VM networking co/hyperv HyperV related issues kind/bug Categorizes issue or PR as related to a bug. os/windows priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done.
Projects
None yet
Development

No branches or pull requests