安装步骤
-
首先安装Docker For Windows
https://docs.docker.com/docker-for-windows/install/#install-docker-for-windows-desktop-app -
下载kubectl
curl -LO https://storage.googleapis.com/kubernetesrelease/release/v1.13.0/bin/windows/amd64/kubectl.exe
-
将kubectl.exe加到path
-
下载安装Minikube
https://github.com/kubernetes/minikube/releases
由于是windows10,我选择:(minikube-windows-amd64)[https://github.com/kubernetes/minikube/releases/download/v0.31.0/minikube-windows-amd64]
下载后重命名为:minikube.exe,然后加入环境path。 -
启动HyperV
右键管理员运行powershell,执行命令:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
然后重启电脑,如果需要。
-
创建SW
在搜索中搜索hyper-v manager打开后新建switch
-
Start
管理员运行cmd或者powershell:minikube start --hyperv-virtual-switch=SW4Minikube --vm-driver=hyperv
Troubleshooting
- Start
C:\Users\xxxx>minikube start
Starting local Kubernetes v1.10.0 cluster...
Starting VM...
Downloading Minikube ISO
178.44 MB / 178.87 MB [============================================] 99.76% 0s
178.87 MB / 178.87 MB [============================================] 100.00% 0sE1213 17:47:37.761137 18592 start.go:180] Error starting host: Error creating host: Error executing step: Running precreate checks.
: This computer is running Hyper-V. VirtualBox won't boot a 64bits VM when Hyper-V is activated. Either use Hyper-V as a driver, or disable the Hyper-V hypervisor. (To skip this check, use --virtualbox-no-vtx-check).
Retrying.
E1213 17:47:37.815463 18592 start.go:186] Error starting host: Error creating host: Error executing step: Running precreate checks.
: This computer is running Hyper-V. VirtualBox won't boot a 64bits VM when Hyper-V is activated. Either use Hyper-V as a driver, or disable the Hyper-V hypervisor. (To skip this check, use --virtualbox-no-vtx-check)
================================================================================
An error has occurred. Would you like to opt in to sending anonymized crash
information to minikube to help prevent future errors?
To opt out of these messages, run the command:
minikube config set WantReportErrorPrompt false
================================================================================
Please enter your response [Y/n]: Y
解决方案:同上,设置hyperv driver。
- Error
Starting local Kubernetes v1.10.0 cluster...
Starting VM...
E1214 10:02:40.692867 5296 start.go:180] Error starting host: Error starting stopped host: exit status 1.
Retrying.
E1214 10:02:40.695827 5296 start.go:186] Error starting host: Error starting stopped host: exit status 1
解决方案:
- 如何开启HyperV服务
参考:https://jingyan.baidu.com/article/c33e3f48f0a42eea14cbb557.html