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

时间:2017-08-20 18:08:48

标签: docker kubernetes minikube

我在发布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,启用了虚拟机管理程序配置。
  • Ubuntu 17.04
  • virtualbox 5.1.22
  • minikube版本:v0.21.0
  • kubectl version 1.7.0

提前致谢

1 个答案:

答案 0 :(得分:0)

@eslimasec,minikube ssh始终使用port forward来访问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

因此当您向minikube vm测试ssh时,应使用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开始的根本原因。

希望它有用。