適用於:Azure Local 上的 AKS
安裝並設定 Azure 本機之後,您必須建立 Arc VM 邏輯網路。 Azure 本機上的 AKS 會使用靜態邏輯網路,為 AKS 叢集的基礎 VM 提供 IP 位址。
開始之前
開始之前,請確定您有下列必要條件:
- 安裝並設定 Azure Local。 請確定您有自定義位置 Azure Resource Manager 識別符,因為此標識碼是建立邏輯網路的必要參數。
- 請確定您所建立的邏輯網路包含足夠的可用IP位址,以避免IP位址耗盡。 IP 位址耗盡可能會導致 Kubernetes 叢集部署失敗。 如需詳細資訊,請參閱 Azure 本機上 AKS 中的網路概念。
- 請確定您有 Azure 本機叢集中所有機器都可以存取的外部 VM 交換器。 根據預設,會在部署 Azure 本機叢集期間建立外部交換器,可用來與您建立的邏輯網路建立關聯。
執行下列命令,以取得 Azure 本機叢集上外部 VM 交換器的名稱:
Get-VmSwitch -SwitchType External
記下開關的名稱。 當您建立邏輯網路時,請使用此資訊。 例如:
Get-VmSwitch -SwitchType External
Name SwitchType NetAdapterInterfaceDescription
---- ---------- ----------------------------
ConvergedSwitch(management_compute_storage) External Teamed-Interface
建立邏輯網路
您可以使用 Azure CLI 或 Azure 入口網站來建立邏輯網路。
若要在靜態 IP 組態中的 VM 交換器上建立邏輯網路,請使用下列 az stack-hci-vm network lnet create 命令:
az stack-hci-vm network lnet create \
--subscription $subscription \
--resource-group $resource_group \
--custom-location $customLocationID \
--name $lnetName \
--vm-switch-name $vmSwitchName \
--ip-allocation-method "Static" \
--address-prefixes $addressPrefixes \
--gateway $gateway \
--dns-servers $dnsServers \
--ip-pool-start $ipPoolStart \
--ip-pool-end $ipPoolEnd \
--vlan 10
對於靜態IP,請提供下列必要參數:
| 必要參數 | 描述 |
|---|---|
--name |
您為 Azure 本機叢集建立的邏輯網路名稱。 請務必提供遵循 Azure 資源規則的名稱。 您無法在建立邏輯網路之後重新命名。 |
--resource-group |
您在其中建立邏輯網路的資源群組名稱。 |
--subscription |
部署 Azure Local 的訂用帳戶名稱或識別碼。 |
--custom-location |
提供與您建立邏輯網路之 Azure 本機叢集相關聯的自定義位置。 |
--vm-switch-name |
VM 交換器的名稱。 使用方式:--vm-switch-name "vm-switch-01"。 |
--address-prefixes |
網路的位址前綴。 目前僅支援一個位址前綴。 使用方式:--address-prefixes "10.220.32.16/24"。 |
--dns-servers |
DNS 伺服器 IP 位址的以空格分隔的清單。 使用方式:--dns-servers 10.220.32.16 10.220.32.17。 |
--gateway |
閘道。 閘道IP位址必須位於位址前綴的範圍內。 使用方式:--gateway 10.220.32.16。 |
--ip-allocation-method |
IP 位址配置方法。 支援值為 Static。 使用方式:--ip-allocation-method "Static"。 |
--ip-pool-start |
IP 集區的起始IP位址。 地址必須位於位址前置詞的範圍內。 使用方式:--ip-pool-start "10.220.32.18"。 |
--ip-pool-end |
IP 集區的結束IP位址。 地址必須位於位址前置詞的範圍內。 使用方式:--ip-pool-end "10.220.32.38"。 |
--vlan |
VLAN 識別碼。 使用方式:--vlan 10。 這是選擇性參數。 指定建立邏輯網路時要使用的 VLAN 識別碼(int32 值)。 |