kubernetes / minikube

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

hyperkit: IP address never found in dhcp leases file Temporary Error: Could not find an IP address for <mac> #4206

Open colangelo opened 5 years ago

colangelo commented 5 years ago

Hi, minikube does not start on my mac, I tried multiple times to remove and reinstall Docker Desktop and docker-machine-driver-hyperkit without solving the problem. It's not related to version 1.0.1, because the problem was present also with version 1.0.0 and maybe also with previous versions that I haven't tested.

When I lanch minikube the /usr/local/bin/docker-machine-driver-hyperkit process appears in the process list, does not use CPU, and it's still present for some time after the command exited.

Can you help me?

The exact command to reproduce the issue:

minikube stop; minikube delete ; rm -rf ~/.minikube
minikube config set vm-driver hyperkit
minikube start -v 10

The full output of the command that failed:

๐Ÿ˜„  minikube v1.0.1 on darwin (amd64)
๐Ÿ’ฟ  Downloading Minikube ISO ...
 142.88 MB / 142.88 MB [============================================] 100.00% 0s
๐Ÿคน  Downloading Kubernetes v1.14.1 images in the background ...
๐Ÿ”ฅ  Creating hyperkit VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
Found binary path at /usr/local/bin/docker-machine-driver-hyperkit
Launching plugin server for driver hyperkit
Plugin server listening at address 127.0.0.1:54243
() Calling .GetVersion
Using API Version  1
() Calling .SetConfigRaw
() Calling .GetMachineName
(minikube) Calling .GetMachineName
(minikube) Calling .DriverName
Creating CA: /Users/user/.minikube/certs/ca.pem
Creating client certificate: /Users/user/.minikube/certs/cert.pem
Running pre-create checks...
(minikube) Calling .PreCreateCheck
(minikube) Calling .GetConfigRaw
Creating machine...
(minikube) Calling .Create
(minikube) Downloading /Users/user/.minikube/cache/boot2docker.iso from file:///Users/user/.minikube/cache/iso/minikube-v1.0.1.iso...
(minikube) DBG | 2019/05/04 17:33:26 [INFO] Creating ssh key...
(minikube) DBG | 2019/05/04 17:33:26 [INFO] Creating raw disk image...
(minikube) DBG | Writing magic tar header
(minikube) DBG | Writing SSH key tar header
(minikube) DBG | Mounting boot2docker.iso
(minikube) DBG | executing: &{/usr/bin/hdiutil [hdiutil attach /Users/user/.minikube/machines/minikube/boot2docker.iso -mountpoint /Users/user/.minikube/machines/minikube/b2d-image] []  <nil> 0xc42000e018 0xc42000e02
0 [] <nil> <nil> <nil> <nil> <nil> false [] [] [] [] <nil> <nil>} attach /Users/user/.minikube/machines/minikube/boot2docker.iso -mountpoint /Users/user/.minikube/machines/minikube/b2d-image
(minikube) /dev/disk3                                           /Users/user/.minikube/machines/minikube/b2d-image
(minikube) DBG | Extracting Kernel Options...
(minikube) DBG | Extracted Options "loglevel=3 user=docker console=ttyS0 console=tty0 noembed nomodeset norestore waitusb=10 systemd.legacy_systemd_cgroup_controller=yes base host=minikube"
(minikube) DBG | Extracting /Users/user/.minikube/machines/minikube/b2d-image/boot/bzImage into /Users/user/.minikube/machines/minikube/bzImage
(minikube) DBG | Extracting /Users/user/.minikube/machines/minikube/b2d-image/boot/initrd into /Users/user/.minikube/machines/minikube/initrd
(minikube) DBG | Unmounting boot2docker.iso
(minikube) DBG | executing: &{/usr/bin/hdiutil [hdiutil detach /Users/user/.minikube/machines/minikube/b2d-image] []  <nil> 0xc42000e018 0xc42000e020 [] <nil> <nil> <nil> <nil> <nil> false [] [] [] [] <nil> <nil>} de
tach /Users/user/.minikube/machines/minikube/b2d-image
(minikube) "disk3" ejected.
(minikube) Using UUID f59fbfd4-6e81-11e9-bb44-f01898eab608
(minikube) Generated MAC 4e:e8:f0:ac:b:3f
(minikube) Starting with cmdline: loglevel=3 user=docker console=ttyS0 console=tty0 noembed nomodeset norestore waitusb=10 systemd.legacy_systemd_cgroup_controller=yes base host=minikube

๐Ÿ’ฃ  Unable to start VM: create: Error creating machine: Error in driver during machine creation: IP address never found in dhcp leases file Temporary Error: Could not find an IP address for 4e:e8:f0:ac:b:3f
Temporary Error: Could not find an IP address for 4e:e8:f0:ac:b:3f
Temporary Error: Could not find an IP address for 4e:e8:f0:ac:b:3f
Temporary Error: Could not find an IP address for 4e:e8:f0:ac:b:3f
Temporary Error: Could not find an IP address for 4e:e8:f0:ac:b:3f
Temporary Error: Could not find an IP address for 4e:e8:f0:ac:b:3f
Temporary Error: Could not find an IP address for 4e:e8:f0:ac:b:3f
Temporary Error: Could not find an IP address for 4e:e8:f0:ac:b:3f
Temporary Error: Could not find an IP address for 4e:e8:f0:ac:b:3f
Temporary Error: Could not find an IP address for 4e:e8:f0:ac:b:3f
Temporary Error: Could not find an IP address for 4e:e8:f0:ac:b:3f
Temporary Error: Could not find an IP address for 4e:e8:f0:ac:b:3f
Temporary Error: Could not find an IP address for 4e:e8:f0:ac:b:3f
Temporary Error: Could not find an IP address for 4e:e8:f0:ac:b:3f
Temporary Error: Could not find an IP address for 4e:e8:f0:ac:b:3f
Temporary Error: Could not find an IP address for 4e:e8:f0:ac:b:3f
Temporary Error: Could not find an IP address for 4e:e8:f0:ac:b:3f
Temporary Error: Could not find an IP address for 4e:e8:f0:ac:b:3f
Temporary Error: Could not find an IP address for 4e:e8:f0:ac:b:3f
Temporary Error: Could not find an IP address for 4e:e8:f0:ac:b:3f
Temporary Error: Could not find an IP address for 4e:e8:f0:ac:b:3f
Temporary Error: Could not find an IP address for 4e:e8:f0:ac:b:3f
Temporary Error: Could not find an IP address for 4e:e8:f0:ac:b:3f
Temporary Error: Could not find an IP address for 4e:e8:f0:ac:b:3f
Temporary Error: Could not find an IP address for 4e:e8:f0:ac:b:3f
Temporary Error: Could not find an IP address for 4e:e8:f0:ac:b:3f
Temporary Error: Could not find an IP address for 4e:e8:f0:ac:b:3f
Temporary Error: Could not find an IP address for 4e:e8:f0:ac:b:3f
Temporary Error: Could not find an IP address for 4e:e8:f0:ac:b:3f
Temporary Error: Could not find an IP address for 4e:e8:f0:ac:b:3f

๐Ÿ˜ฟ  Sorry that minikube crashed. If this was unexpected, we would love to hear from you:
๐Ÿ‘‰  https://github.com/kubernetes/minikube/issues/new

The output of the minikube logs command:

๐Ÿ’ฃ  command runner: getting ssh client for bootstrapper: Error dialing tcp via ssh client: dial tcp :22: connect: connection refused

๐Ÿ˜ฟ  Sorry that minikube crashed. If this was unexpected, we would love to hear from you:
๐Ÿ‘‰  https://github.com/kubernetes/minikube/issues/new

The operating system version:

macOS Mojave 10.14.4 (18E226) Darwin mac.local 18.5.0 Darwin Kernel Version 18.5.0: Mon Mar 11 20:40:32 PDT 2019; root:xnu-4903.251.3~3/RELEASE_X8664 x86

amirsalaar commented 2 years ago

for my case, I had my corporation antivirus running (particularly McAfee), which was blocking the creation of dhcpd_leases. After turning that off and shutting the firewall temporarily, it got fixed.

edrandall commented 2 years ago

Running MacOS Big Sur 11.6.2 in a corporate environment which has the pf firewall configured, have been experiencing this issue.

I created a new pf rules file /etc/pf.anchors/io.k8s.sigs.minikube and whittled it down to the following rule:

# log is optional and uses `pflog0` by default;  `man pflog` gives instructions to see the logged packets
pass log on bridge100 inet proto udp from any port bootpc to port bootps

Unsure whether the bridge100 device is hard-coded or might change in future, would like to keep the rule as specific as possible.

Reference the rules file in /etc/pf.conf:

anchor "minikube"
load anchor "minikube" from "/etc/pf.anchors/io.k8s.sigs.minikube"

To reload pf using the updated rules:

# pfctl -d
# pfctl -e -f /etc/pf.conf

Cleared everything down with minikube delete then restarted minikube start, the following appears in the pflog0 tcpdump:

 00:00:04.420007 rule 2.minikube.0/0(match): pass in on bridge100: 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from ca:7e:32:41:3f:16, length 278

The minikube starts successfully.

georhiireva commented 2 years ago

Hello, colleagues. MacOs BigSur. I had the same issue with minishift and used recommendations from this topic to fix. I tried all options and this works for me (just use minikube instead of minishift):

  1. minishift stop
  2. minishift delete --clear-cache
  3. rm -fr ~/.minishift
  4. brew reinstall hyperkit
  5. brew reinstall docker-machine-driver-hyperkit
  6. sudo chown root:wheel /usr/local/bin/docker-machine-driver-hyperkit && sudo chmod u+s /usr/local/bin/docker-machine-driver-hyperkit
  7. sudo chown root:wheel /usr/local/bin/hyperkit && sudo chmod u+s /usr/local/bin/hyperkit
  8. minishift config set vm-driver hyperkit (u'll have message: instance doesn't exist bla bla, will be set on next start - it's ok)
  9. minishift start Minishift start successfully. PS: Check the location of docker-machine-driver-hyperkit and hyperkit before points 6 and 7. I hope this will help somebody.
cr-tech-repo commented 2 years ago

@georhiireva - There is typo in your second command with the work minishift and cache

georhiireva commented 2 years ago

@georhiireva - There is typo in your second command with the work minishift and cache

@cr-tech-repo , thanks, fix it

kanwarysingh commented 2 years ago

Running MacOS Big Sur 11.6.2 in a corporate environment which has the pf firewall configured, have been experiencing this issue.

I created a new pf rules file /etc/pf.anchors/io.k8s.sigs.minikube and whittled it down to the following rule:

# log is optional and uses `pflog0` by default;  `man pflog` gives instructions to see the logged packets
pass log on bridge100 inet proto udp from any port bootpc to port bootps

Unsure whether the bridge100 device is hard-coded or might change in future, would like to keep the rule as specific as possible.

Reference the rules file in /etc/pf.conf:

anchor "minikube"
load anchor "minikube" from "/etc/pf.anchors/io.k8s.sigs.minikube"

To reload pf using the updated rules:

# pfctl -d
# pfctl -e -f /etc/pf.conf

Cleared everything down with minikube delete then restarted minikube start, the following appears in the pflog0 tcpdump:

 00:00:04.420007 rule 2.minikube.0/0(match): pass in on bridge100: 0.0.0.0.68 > 255.255.255.255.67: BOOTP/DHCP, Request from ca:7e:32:41:3f:16, length 278

The minikube starts successfully.

@edrandall I get a syntax error while enabling the firewall. Any idea which part might be causing it?

/etc/pf.conf:36: syntax error
pfctl: Syntax error in config file: pf rules not loaded
pfctl: load anchors

/etc/pf.conf:

scrub-anchor "cisco.anyconnect.vpn"
scrub-anchor "com.apple/*"
nat-anchor "com.apple/*"
rdr-anchor "com.apple/*"
dummynet-anchor "com.apple/*"
anchor "cisco.anyconnect.vpn"
load anchor "cisco.anyconnect.vpn" from "/opt/cisco/anyconnect/ac_pf.conf"
anchor "com.apple/*"
load anchor "com.apple" from "/etc/pf.anchors/com.apple"
# com.crowdstrike anchor point
anchor "com.crowdstrike"
load anchor "com.crowdstrike" from "/etc/pf.anchors/com.crowdstrike"
anchor "minikube"
load anchor "minikube" from "/etc/pf.anchors/io.k8s.sigs.minikube"

/etc/pf.anchors/io.k8s.sigs.minikube:

# log is optional and uses `pflog0` by default;  `man pflog` gives instructions to see the logged packets
pass log on bridge100 inet proto udp from any port bootpc to port bootps

I am on MacOS Catalina 10.15.7.

edrandall commented 2 years ago

probably a mismatched quote somewhere, could be in pf.conf or any of your anchor files.

jvinceller commented 2 years ago

I've tried all the solutions with a Mac M1 with Monterey and the x86 (Rosetta) execution mode and I couldn't get minishift or minikube working. It's always something at the network adapter. My Mac seems to have the leases at /var/db/dhcpclient/leases and not under _/var/db/dhcpleases anyway.

julienbonastre commented 2 years ago

Facing this issue too on BigSur Mac - tried all tricks about to no avail

edrandall commented 2 years ago

Try the following packet filter rules:

#
# Allows minikube to run using hyperkit
# /etc/pf.anchors/io.k8s.sigs.minikube - load by adding 2 lines to /etc/pf.conf:
# ---
# anchor "io.k8s.sigs.minikube"
# load anchor "io.k8s.sigs.minikube" from "/etc/pf.anchors/io.k8s.sigs.minikube"
# ---
# Restart: pfctl -d ; pfctl -e -f /etc/pf.conf
# To watch logged packets, add "log" directive to rule(s) and run:
# ifconfig pflog0 create
# tcpdump -n -e -ttt -i pflog0
#

# Allow hyperkit DHCP packet in
pass on bridge100 inet proto udp from any port bootpc to port bootps

# Allow hyperkit to pull images
pass inet proto udp from 192.168.0.0/16 to any port 53
pass inet proto tcp from 192.168.0.0/16 to any
NaoyukiTai commented 2 years ago

This is biting me as well. I followed up most of suggestions including the /etc/pf.anchors. I cannot turn off the firewall as my company Mac is under control of Falcon.

Mac is Intel, Monterey 12.4. As of 2022-07-18, as far as I can tell, minikube - 1.26.0 hyperkit - 0.20200908 docker-machine-driver-hyperkit - 1.0.0

minikube_logs_1b004fc441daa6a7016058454b974cf8421ba12a_0.log

logs.txt

maffydavison commented 2 years ago

I'm on Mac Monterrey and saw the note about the dhcp_leases file not being there (true) but /var/db/dhcpclient containing IP information. I'm in a crunch to get through this K8s tutorial, so I thought I'd try something down and dirty and copy one of the files from the dhcpclient to /var/db/dhcpd_leases and see if that worked -- but it couldn't parse XML, so I'm stuck again. I'll clean up my hack and pull the logs - but the issue remains that there is no such file as dhcpd_leases

๐Ÿ˜ฟ Failed to start hyperkit VM. Running "minikube delete" may fix it: creating host: create: Error creating machine: Error in driver during machine creation: IP address never found in dhcp leases file Temporary error: unable to parse line: <?xml version="1.0" encoding="UTF-8"? minikube_logs_d5f6b3eb7402185b5cbe7c8e6ab1ab332f57ca4f_0.log logs.txt

andriytk commented 1 year ago

It fixed for me after I uninstalled Falcon Sensor. (macOS-2.6.1)

caerulescens commented 8 months ago

I'm going to investigate starting hyperkit on a MacBook Pro with an Intel (x86) processor; I'll report what I find.

caerulescens commented 8 months ago

/assign