为什么minikube有时有时会在Mac OS High Sierra 10.13.6上挂起?

时间:2018-11-01 19:17:50

标签: kubernetes minikube

昨天我将Mac升级到10.13.6版,重新启动了Mac笔记本电脑。现在,minikube无法启动。 Docker Community Edition 18.06.1-ce正在运行。日志如下。任何人都可以发现问题所在。我该如何调试呢?

$ minikube version
minikube version: v0.30.0


$ minikube update-check
CurrentVersion: v0.30.0
LatestVersion: v0.30.0


$ minikube start --v=999 --logtostderr   --vm-driver=hyperkit
W1101 12:02:25.674822   24809 root.go:146] Error reading config file at /Users/user/.minikube/config/config.json: open /Users/user/.minikube/config/config.json: no such file or directory
I1101 12:02:25.675028   24809 notify.go:121] Checking for updates...
I1101 12:02:25.971633   24809 start.go:99] Viper configuration:
Aliases:
map[string]string{}
Override:
map[string]interface {}{"v":"999"}
PFlags:
map[string]viper.FlagValue{"apiserver-names":viper.pflagValue{flag:(*pflag.Flag)(0xc42033a460)}, "network-plugin":viper.pflagValue{flag:(*pflag.Flag)(0xc42033a8c0)}, "registry-mirror":viper.pflagValue{flag:(*pflag.Flag)(0xc42033a6e0)}, "vm-driver":viper.pflagValue{flag:(*pflag.Flag)(0xc420367c20)}, "cpus":viper.pflagValue{flag:(*pflag.Flag)(0xc420367d60)}, "disk-size":viper.pflagValue{flag:(*pflag.Flag)(0xc420367e00)}, "feature-gates":viper.pflagValue{flag:(*pflag.Flag)(0xc42033a960)}, "hyperkit-vsock-ports":viper.pflagValue{flag:(*pflag.Flag)(0xc42033ac80)}, "disable-driver-mounts":viper.pflagValue{flag:(*pflag.Flag)(0xc420367ae0)}, "gpu":viper.pflagValue{flag:(*pflag.Flag)(0xc42033ad20)}, "nfs-share":viper.pflagValue{flag:(*pflag.Flag)(0xc42033a140)}, "uuid":viper.pflagValue{flag:(*pflag.Flag)(0xc42033ab40)}, "apiserver-name":viper.pflagValue{flag:(*pflag.Flag)(0xc42033a3c0)}, "cache-images":viper.pflagValue{flag:(*pflag.Flag)(0xc42033aa00)}, "xhyve-disk-driver":viper.pflagValue{flag:(*pflag.Flag)(0xc42033a0a0)}, "dns-domain":viper.pflagValue{flag:(*pflag.Flag)(0xc42033a5a0)}, "docker-opt":viper.pflagValue{flag:(*pflag.Flag)(0xc42033a320)}, "host-only-cidr":viper.pflagValue{flag:(*pflag.Flag)(0xc420367ea0)}, "memory":viper.pflagValue{flag:(*pflag.Flag)(0xc420367cc0)}, "nfs-shares-root":viper.pflagValue{flag:(*pflag.Flag)(0xc42033a1e0)}, "iso-url":viper.pflagValue{flag:(*pflag.Flag)(0xc420367b80)}, "bootstrapper":viper.pflagValue{flag:(*pflag.Flag)(0xc420366fa0)}, "container-runtime":viper.pflagValue{flag:(*pflag.Flag)(0xc42033a780)}, "docker-env":viper.pflagValue{flag:(*pflag.Flag)(0xc42033a280)}, "extra-config":viper.pflagValue{flag:(*pflag.Flag)(0xc42033aaa0)}, "insecure-registry":viper.pflagValue{flag:(*pflag.Flag)(0xc42033a640)}, "apiserver-ips":viper.pflagValue{flag:(*pflag.Flag)(0xc42033a500)}, "keep-context":viper.pflagValue{flag:(*pflag.Flag)(0xc420367900)}, "kvm-network":viper.pflagValue{flag:(*pflag.Flag)(0xc42033a000)}, "mount":viper.pflagValue{flag:(*pflag.Flag)(0xc4203679a0)}, "mount-string":viper.pflagValue{flag:(*pflag.Flag)(0xc420367a40)}, "profile":viper.pflagValue{flag:(*pflag.Flag)(0xc420366f00)}, "hyperkit-vpnkit-sock":viper.pflagValue{flag:(*pflag.Flag)(0xc42033abe0)}, "hyperv-virtual-switch":viper.pflagValue{flag:(*pflag.Flag)(0xc420367f40)}, "kubernetes-version":viper.pflagValue{flag:(*pflag.Flag)(0xc42033a820)}}
Env:
map[string]string{}
Key/Value Store:
map[string]interface {}{}
Config:
map[string]interface {}{}
Defaults:
map[string]interface {}{"log_dir":"", "reminderwaitperiodinhours":24, "wantnonedriverwarning":true, "showdriverdeprecationnotification":true, "showbootstrapperdeprecationnotification":true, "v":"0", "alsologtostderr":"false", "wantupdatenotification":true, "wantreporterror":false, "wantreporterrorprompt":true, "wantkubectldownloadmsg":true}
Starting local Kubernetes v1.10.0 cluster...
Starting VM...
I1101 12:02:25.972050   24809 utils.go:100] retry loop 0
I1101 12:02:25.972089   24809 cluster.go:73] Skipping create...Using existing machine configuration
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:56021
() Calling .GetVersion
Using API Version  1
() Calling .SetConfigRaw
() Calling .GetMachineName
(minikube) Calling .GetState
I1101 12:02:26.011670   24809 cluster.go:82] Machine state:  Stopped
(minikube) Calling .Start
(minikube) Using UUID fa403fab-dbb5-11e8-812b-8c859058d45f
(minikube) Generated MAC 86:5b:e6:33:fc:a1
(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
(minikube) Calling .GetConfigRaw
(minikube) Calling .DriverName
Waiting for SSH to be available...
Getting to WaitForSSH function...
(minikube) Calling .GetSSHHostname
(minikube) Calling .GetSSHPort
(minikube) Calling .GetSSHKeyPath
(minikube) Calling .GetSSHKeyPath
(minikube) Calling .GetSSHUsername
Using SSH client type: native
&{{{<nil> 0 [] [] []} docker [0x140f940] 0x140f910  [] 0s} 192.168.64.4 22 <nil> <nil>}
About to run SSH command:
exit 0

Error dialing TCP: dial tcp 192.168.64.4:22: connect: operation timed out
Error dialing TCP: dial tcp 192.168.64.4:22: connect: operation timed out
Error dialing TCP: dial tcp 192.168.64.4:22: connect: operation timed out

更新:我在/Users/user/.minikube/config/config.json中创建了一个包含{}的json文件,但该文件仍然挂起。

我打印了进程树,发现子进程

/usr/local/bin/docker-machine-driver-hyperkit

是一个挂着的东西。

2 个答案:

答案 0 :(得分:3)

我的猜测是xhyve / Hyperkit VM的IP地址已更改。当您进行Mac OS升级时,它可能会改变。

您可以在/Users/youruser/.minikube/machines/minikube/config.json中对其进行更新:

{
    "ConfigVersion": 3,
    "Driver": {
        "IPAddress": "192.168.64.2",  <== here
        "MachineName": "minikube",
        "SSHUser": "docker",
        "SSHPort": 22,
        "SSHKeyPath": "/Users/youruser/.minikube/machines/minikube/id_rsa",
        "StorePath": "/Users/youruser/.minikube",
        "SwarmMaster": false,
        "SwarmHost": "",
        "SwarmDiscovery": "",
        "Boot2DockerURL": "file:///Users/youruser/.minikube/cache/iso/minikube-v0.30.0.iso",
        "DiskSize": 20000,
        "CPU": 2,
        "Memory": 2048,
        "Cmdline": "loglevel=3 user=docker console=ttyS0 console=tty0 noembed nomodeset norestore waitusb=10 systemd.legacy_systemd_cgroup_controller=yes base host=minikube",
        "NFSShares": [],
        "NFSSharesRoot": "/nfsshares",
        "UUID": "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
        "VpnKitSock": "",
        "VSockPorts": []
    },
    ...

您可以通过进入虚拟机来获取IP地址:

$ sudo screen /Users/youruser/.minikube/machines/minikube/tty # you need your mac sudo password
<enter>
Welcome to minikube
minikube login: root<enter>
                         _             _
            _         _ ( )           ( )
  ___ ___  (_)  ___  (_)| |/')  _   _ | |_      __
/' _ ` _ `\| |/' _ `\| || , <  ( ) ( )| '_`\  /'__`\
| ( ) ( ) || || ( ) || || |\`\ | (_) || |_) )(  ___/
(_) (_) (_)(_)(_) (_)(_)(_) (_)`\___/'(_,__/'`\____)

# ifconfig
docker0   Link encap:Ethernet  HWaddr 02:42:06:3F:18:54
          inet addr:172.17.0.1  Bcast:172.17.255.255  Mask:255.255.0.0
          inet6 addr: fe80::42:6ff:fe3f:1854/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:39173 errors:0 dropped:0 overruns:0 frame:0
          TX packets:49410 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:7801618 (7.4 MiB)  TX bytes:12392980 (11.8 MiB)

eth0      Link encap:Ethernet  HWaddr D2:EE:50:CB:B5:94
          inet addr:192.168.64.2  Bcast:192.168.64.255  Mask:255.255.255.0 <== This addr
          inet6 addr: fe80::d0ee:50ff:fecb:b594/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:234201 errors:0 dropped:0 overruns:0 frame:112
          TX packets:70224 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:325353860 (310.2 MiB)  TX bytes:4951049 (4.7 MiB)
...

您可能必须在/Users/youruser/.minikube/profiles/minikube

的Kubernetes配置中更新IP。

最后,/Users/youruser/.kube/config中的配置:

...
- cluster:
certificate-authority: /Users/youruser/.minikube/ca.crt
server: https://192.168.64.2:8443 => here.
name: minikube
...

注意:如果将kube-apiserver证书绑定到IP地址,则可能会重新生成它们。

另外,请注意,我也看到了:

W1101 16:07:41.121373   59126 root.go:146] Error reading config file at /Users/youruser/.minikube/config/config.json: open /Users/youruser/.minikube/config/config.json: no such file or directory

我的VM启动正常。

答案 1 :(得分:0)

我一直通过以下方式解决此类问题:

if locNameFrom.count > 0 {
    cell?.from.text = locNameFrom[indexPath.row]
}