SSH不响应时删除Minikube VM

时间:2019-07-15 01:54:59

标签: windows powershell ssh minikube

我想要的:我想删除当前的minikube或对其进行修复,以便可以继续使用kubectl进行开发。

背景:昨晚我有一个正在运行的minikube VM。我今天早上醒来时,minikube VM无法响应kubectl命令。我运行了这些命令进行调查。

命令1

minikube status

输出1

X Error getting bootstrapper: getting kubeadm bootstrapper: command runner:
getting ssh client for bootstrapper: Error dialing tcp via ssh client: dial
tcp 192.168.0.24:22: connectex: No connection could be made because the target
machine actively refused it.

* Sorry that minikube crashed. If this was unexpected, we would love to hear
from you:
  - https://github.com/kubernetes/minikube/issues/new

命令2

minikube start

输出2

* minikube v1.2.0 on windows (amd64)

! Ignoring --vm-driver=virtualbox, as the existing "minikube" VM was created using the hyperv driver.
! To switch drivers, you may create a new VM using `minikube start -p  --vm-driver=virtualbox`
! Alternatively, you may delete the existing VM using `minikube delete -p minikube`

* Re-using the currently running hyperv VM for "minikube" ...
* Waiting for SSH access ...
E0714 10:29:40.514508   25244 start.go:559] StartHost: Temporary Error: Error configuring auth on host: OS type not recognized

命令3

minikube stop

输出3

* Stopping "minikube" in hyperv ...

在PowerShell窗口中,此操作在完成0%时停止。我用 Ctrl + C 停止了该过程。

命令4

minikube ssh

输出4

ssh: dial tcp 192.168.0.24:22: connectex: No connection could be made because
the target machine actively refused it.

命令5

minikube delete

输出5

* Powering off "minikube" via SSH ...
* Deleting "minikube" from hyperv ...

X Failed to delete cluster: exit status 1

* Sorry that minikube crashed. If this was unexpected, we would love to hear
from you:
  - https://github.com/kubernetes/minikube/issues/new

更新 该命令有效minikube delete -p minikube,有人可以告诉我为什么有效,但是minikube delete无效。

2 个答案:

答案 0 :(得分:0)

实际上,对我来说,这两个命令对我都有效:

C:\ windows \ system32> minikube删除 *通过SSH关闭“ minikube”电源... *从hyperv删除“ minikube” ... *“ minikube”集群已删除。

C:\ windows \ system32> minikube删除-p minikube *通过SSH关闭“ minikube”电源... *从hyperv删除“ minikube” ... *“ minikube”集群已删除。

我查看了一些文档,统计到“ minikube delete”命令删除了当前正在使用的VM,但是“ minikube delete -p minikube”删除了指定的VM(可以是活动的或不活动的)。

答案 1 :(得分:0)

这似乎是由Windows防火墙引起的,默认情况下,Windows防火墙会将Hyper-V虚拟交换机视为不受信任的网络。

@RomanIakovlev在Github上进行了讨论,该书可以读成here

  

...   解决方案是使用以下PowerShell命令(您必须使用管理员权限运行PowerShell)将其类别切换为私有,假定minikube的虚拟交换机称为“ minikube”:

     

Set-NetConnectionProfile -interfacealias "vEthernet (minikube)" -NetworkCategory Private

@robymontyz也提到了这一点:

  

我对hyperkit有同样的问题。我今天解决了升级到最新版本的minikube(1.2.0)并从here安装相应版本的hyperkit驱动程序的问题。