VMware vSphere Tanzu部署_04_vCenter管理esxi并迁移网卡到DSwitch
整体文章
VMware vSphere Tanzu部署_01_Tanzu架构设计
VMware vSphere Tanzu部署_02_ESXI系统安装
VMware vSphere Tanzu部署_03_vCenter部署
VMware vSphere Tanzu部署_04_vCenter管理esxi并迁移网卡到DSwitch
VMware vSphere Tanzu部署_05_vyos虚拟路由器部署
VMware vSphere Tanzu部署_06_haproxy部署
VMware vSphere Tanzu部署_07_tanzu存储策略配置
VMware vSphere Tanzu部署_08_配置tanzu为单节点
VMware vSphere Tanzu部署_09_配置tanzu内容库
VMware vSphere Tanzu部署_10_开启Tanzu功能
VMware vSphere Tanzu部署_11_创建TKC命名空间
VMware vSphere Tanzu部署_12_下载使用Tanzu-K8S工具
VMware vSphere Tanzu部署_13_创建TKC集群
VMware vSphere Tanzu部署_14_部署容器应用
VMware vSphere Tanzu部署_15_TKG Cluster获取永不过期Token
VMware vSphere Tanzu部署_16_TKC集群节点VM密码获取
本次操作采用powershell来进行操作
1.安装powershell和VM插件
1.1. 安装powershell
-
- 在如下位置下载powershell进行:https://github.com/PowerShell/PowerShell/releases
1.2. 安装vm组件
- 在cmd内输入pwsh后,输入:Install-Module -Name VMware.PowerCLI -Scope CurrentUser 进行组件安装
Install-Module -Name VMware.PowerCLI -Scope CurrentUser
2.配置脚本
2.1.配置管理脚本
# vcenter信息
$VCSAHostname = "192.168.201.10"
# vcenter账号
$VCSAUsername = "administrator@vsphere.local"
# vcenter密码
$VCSAPassword = "VMware1!VMware1!"
# 将要创建的数据中心名
$DatacenterName = "Datacenter"
# 存储磁盘名
$DatastoreName = "datastore"
# 将要创建的集群名
$ClusterName = "Tanzu-Cluster"
# esxi信息
$ESXiHostname = "192.168.201.11"
# esxi密码
$ESXiPassword = "VMware1!VMware1!"
# 设置的vDS交换机名称
$VDSName = "DSwitch"
# 创建的vDS虚拟
$VDSManagementPG = "management"
$VDSFrontendPG = "frontend"
$VDSWorkloadPG = "workload"
# tanzi存储策略名称和tag
$StoragePolicyName = "tanzu-storage-policy"
$StoragePolicyCategory = "workloadtype"
$StoragePolicyTag = "tanzu"
$vc = Connect-VIServer $VCSAHostname -User $VCSAUsername -Password $VCSAPassword
Write-Host "Disabling Network Rollback for 1-NIC VDS ..."
Get-AdvancedSetting -Entity $vc -Name "config.vpxd.network.rollback" | Set-AdvancedSetting -Value false -Confirm:$false
Write-Host "Creating vSphere Datacenter ${DatacenterName} ..."
New-Datacenter -Server $vc -Name $DatacenterName -Location (Get-Folder -Type Datacenter -Server $vc)
Write-Host "Creating vSphere Cluster ${ClusterName} ..."
New-Cluster -Server $vc -Name $ClusterName -Location (Get-Datacenter -Name $DatacenterName -Server $vc) -DrsEnabled -HAEnabled
Write-Host "Disabling Network Redudancy Warning ..."
(Get-Cluster -Server $vc $ClusterName) | New-AdvancedSetting -Name "das.ignoreRedundantNetWarning" -Type ClusterHA -Value $true -Confirm:$false
Write-Host "Adding ESXi host ${ESXiHostname} ..."
Add-VMHost -Server $vc -Location (Get-Cluster -Name $ClusterName) -User "root" -Password $ESXiPassword -Name $ESXiHostname -Force
Write-Host "Creating Distributed Virtual Switch ${VDSName} ..."
New-VDSwitch -Server $vc -Name $VDSName -Location (Get-Datacenter -Name $DatacenterName) -NumUplinkPorts 1
# 创建vds接口,且设置的端口类型是临时端口
Write-Host "Creating Distributed Portgroup ${VDSManagementPG},${VDSFrontendPG}, ${VDSWorkloadPG} and ${VDSVMNetworkPG} ..."
New-VDPortgroup -Server $vc -Name $VDSManagementPG -Vds (Get-VDSwitch -Server $vc -Name $VDSName) -PortBinding Ephemeral
New-VDPortgroup -Server $vc -Name $VDSFrontendPG -Vds (Get-VDSwitch -Server $vc -Name $VDSName) -PortBinding Ephemeral
New-VDPortgroup -Server $vc -Name $VDSWorkloadPG -Vds (Get-VDSwitch -Server $vc -Name $VDSName) -PortBinding Ephemeral
Write-Host "Creating vSphere Tag Category `"${StoragePolicyCategory}`" and vSphere Tag `"${StoragePolicyTag}`" for Storage Policy `"${StoragePolicyName}`" ... "
New-TagCategory -Server $vc -Name $StoragePolicyCategory -Cardinality single -EntityType Datastore
New-Tag -Server $vc -Name $StoragePolicyTag -Category $StoragePolicyCategory
Get-Datastore -Server $vc -Name $DatastoreName | New-TagAssignment -Server $vc -Tag $StoragePolicyTag
New-SpbmStoragePolicy -Server $vc -Name $StoragePolicyName -AnyOfRuleSets (New-SpbmRuleSet -Name "tanzu-ruleset" -AllOfRules (New-SpbmRule -AnyOfTags (Get-Tag $StoragePolicyTag)))
2.2.执行配置管理脚本
- 在cmd内输入pwsh后,找到ps1脚本直接运行
3.迁移vswitch到DSwitch
3.1. 迁移vswitch到DSwitch
- 在DSwitch在添加esxi主机
- 将vmnic0接口分配给DSwitch
- 设置vmk0的网络为management
3.2. 设置vcenter虚拟机网卡为vds网络
- 登录esxi系统,手动进行虚拟网卡的修改