在Hyper-V虚机上安装Kubernetes
Enable Hyper-V
# In Powershell (administrator mode)
> Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
添加VSwitch
-
创建一个External的vSwitch,命名为BVSwitch (注意勾选allow management OS to share)
-
创建一个Internal的vSwitch,命名为BVSwitch_Int
-
在Windows设置->Network & Internet -> Status -> Network & Sharing Center,找到创建的Internal vSwitch
-
点击打开配置界面,点击Properties
-
设置IPv4网段如下:
添加Virtual Machine
-
创建Controller虚机,选择Gen2,4096M内存,连接到BVSwitch(external)。然后在setting处disable secure boot,选择CPU数为4,静态MAC地址(VM)
-
下载Ubuntu20.04 LTS,选择minimal安装,并disable apt periodic update service,以及设置mirror。Quick Link to Step by Step Guide
配置网络拓扑
- 在Hyper-V Manager界面,选择Controller,增加一块网卡,连接到BVSwitch_Int。
- 选择Worker,修改当前网卡,使其连接到BVSwitch_Int。
优化分辨率(Optional)
- Link to learn.microsoft.com
- 于Windows Powershell(administrator mode)
PS C:\Users\<YOUR ID>> Set-VMVideo -VMName "controller" -HorizontalResolution 1600 -VerticalResolution 900 -ResolutionType Single
PS C:\Users\<YOUR ID>> Set-VMVideo -VMName "worker1" -HorizontalResolution 1600 -VerticalResolution 900 -ResolutionType Single
PS C:\Users\<YOUR ID>> Set-VMVideo -VMName "worker2" -HorizontalResolution 1600 -VerticalResolution 900 -ResolutionType Single
安装Kubernetes
- 请参考: 在Ubuntu安装Kubernetes