新鲜minikube安装启动时挂起(ssh错误)

发出minikube start(minikube start –vm-driver = virtualbox –v = 7)命令时出现以下错误:

Waiting for SSH to be available... Getting to WaitForSSH function... Using SSH client type: external Using SSH private key: /root/.minikube/machines/minikube/id_rsa (-rw-------) &{[-F /dev/null -o PasswordAuthentication=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -o ConnectionAttempts=3 -o ConnectTimeout=10 -o ControlMaster=no -o ControlPath=none docker@127.0.0.1 -o IdentitiesOnly=yes -i /root/.minikube/machines/minikube/id_rsa -p 22] /usr/bin/ssh <nil>} About to run SSH command: exit 0 SSH cmd err, output: exit status 255: Error getting ssh command 'exit 0' : ssh command error: command : exit 0 err : exit status 255 output : 

在研究上面的日志行时,我注意到ssh命令不是针对minikube虚拟机的IP,而是127.0.0.1。 如果手动运行ssh命令到127.0.0.1我得到一个权限被拒绝的错误。

 /usr/bin/ssh -o PasswordAuthentication=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectionAttempts=3 -o ConnectTimeout=10 -o ControlMaster=no -o ControlPath=none docker@127.0.0.1 -o IdentitiesOnly=yes -i /root/.minikube/machines/minikube/id_rsa -p 22 Warning: Permanently added '127.0.0.1' (ECDSA) to the list of known hosts. Permission denied (publickey,password). 

不应该脚本连接到127.0.0.1以外的minikube IP? 这里是vboxmanage showvminfo的输出

 /usr/bin/VBoxManage showvminfo minikube | grep NIC NIC 1: MAC: 08002790443F, Attachment: NAT, Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none NIC 1 Settings: MTU: 0, Socket (send: 64, receive: 64), TCP Window (send:64, receive: 64) NIC 1 Rule(0): name = ssh, protocol = tcp, host ip = 127.0.0.1, host port = 37549, guest ip = , guest port = 22 NIC 2: MAC: 08002790D54C, Attachment: Host-only Interface 'vboxnet0', Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none 

我的系统布局如下:

  • Vmwareplayer 6.0.5 build-2443746,启用虚拟机pipe理程序configuration。
  • Ubuntu 17.04
  • virtualbox 5.1.22
  • minikube版本:v0.21.0
  • kubectl版本1.7.0

提前致谢

@eslimasec,minikube ssh总是使用端口转发来访问vm:

 NIC 1 Rule(0): name = ssh, protocol = tcp, host ip = 127.0.0.1, host port = 37549, guest ip = , guest port = 22 

当你ssh to 127.0.0.1:37549 will forward to vm:22

所以当你testingSSH到minikube vm ,应该使用port 37549而不是22

 /usr/bin/ssh -o PasswordAuthentication=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectionAttempts=3 -o ConnectTimeout=10 -o ControlMaster=no -o ControlPath=none docker@127.0.0.1 -o IdentitiesOnly=yes -i /root/.minikube/machines/minikube/id_rsa -p **37549** 

这也是你minikube开始的根本原因。

希望这是有帮助的。