1. 程式人生 > >K8s: 在Windows10安裝執行Minikube並使用HyperV driver

K8s: 在Windows10安裝執行Minikube並使用HyperV driver

安裝步驟

  1. 首先安裝Docker For Windows
    https://docs.docker.com/docker-for-windows/install/#install-docker-for-windows-desktop-app

  2. 下載kubectl
    curl -LO https://storage.googleapis.com/kubernetesrelease/release/v1.13.0/bin/windows/amd64/kubectl.exe

  3. 將kubectl.exe加到path

  4. 下載安裝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。

  5. 啟動HyperV
    右鍵管理員執行powershell,執行命令:
    Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
    然後重啟電腦,如果需要
    1

  6. 建立SW
    在搜尋中搜索hyper-v manager開啟後新建switch
    1


    2

  7. 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

解決方案:

參考

https://kubernetes.io/docs/setup/minikube/#quickstart