快速入門:使用 Nginx 設計容器化網路功能 (CNF) 網路服務設計
本快速入門說明如何使用 az aosm
Azure CLI 擴充功能來建立及發佈基本網路服務設計。
必要條件
- 需要具作用中訂用帳戶的 Azure 帳戶。 如果您沒有 Azure 訂用帳戶,請依照此處 的指示開始免費 建立帳戶,再開始。
- 完成快速入門:將 Nginx 容器發佈為容器化網路函式 (CNF)。
建立輸入檔
建立用於發佈網路服務設計版本和相關聯資源的輸入檔。 執行下列命令來產生網路服務設計版本 (NSDV) 的輸入組態檔。
az aosm nsd generate-config
執行上述命令會產生 nsd-input.jsonc 檔案。
注意
編輯input.json檔案。 將它取代為範例中顯示的值。 將檔案儲存為 input-cnf-nsd.jsonc。
以下是範例 input-cnf-nsd.jsonc:
{
// Azure location to use when creating resources e.g uksouth
"location": "uksouth",
// Name of the Publisher resource you want your definition published to.
// Will be created if it does not exist.
"publisher_name": "nginx-publisher",
// Resource group for the Publisher resource.
// Will be created if it does not exist.
"publisher_resource_group_name": "nginx-publisher-rg",
// Name of the ACR Artifact Store resource.
// Will be created if it does not exist.
"acr_artifact_store_name": "nginx-nsd-acr",
// Network Service Design (NSD) name. This is the collection of Network Service Design Versions. Will be created if it does not exist.
"nsd_name": "nginx-nsdg",
// Version of the NSD to be created. This should be in the format A.B.C
"nsd_version": "1.0.0",
// Optional. Description of the Network Service Design Version (NSDV).
"nsdv_description": "Deploys a basic NGINX CNF",
// List of Resource Element Templates (RETs).
// There must be at least one NF RET.
// ArmTemplate RETs are optional. Delete if not required.
"resource_element_templates": [
{
// Type of Resource Element. Either NF or ArmTemplate
"resource_element_type": "NF",
"properties": {
// The name of the existing publisher for the NSD.
"publisher": "nginx-publisher",
// The resource group that the publisher is hosted in.
"publisher_resource_group": "nginx-publisher-rg",
// The name of the existing Network Function Definition Group to deploy using this NSD.
// This will be the same as the NF name if you published your NFDV using the CLI.
"name": "nginx",
// The version of the existing Network Function Definition to base this NSD on.
// This NSD will be able to deploy any NFDV with deployment parameters compatible with this version.
"version": "1.0.0",
// The region that the NFDV is published to.
"publisher_offering_location": "uksouth",
// Type of Network Function. Valid values are 'cnf' or 'vnf'.
"type": "cnf"
}
}
]
}
- publisher_name - 您要發佈定義之發行者資源的名稱。 如果它不存在,則建立。
- publisher_resource_group_name - 發行者資源的資源群組。 如果它不存在,則建立。 在本快速入門中,建議您使用發佈網路函式定義時所使用的相同資源群組。
- acr_artifact_store_name - ACR 成品存放區資源的名稱。 如果它不存在,則建立。
- location - 建立資源時要使用的 Azure 位置。
- nsd_name - 網路服務設計組名。 網路服務設計版本的集合。 如果它不存在,則建立。
- nsd_version - 要建立的 NSD 版本。 以 A.B.C 的格式表示。
- nsdv_description - NSDV 的描述。
- resource_element_templates:
- publisher - 此 NFDV 發行者的名稱。
- publisher_resource_group - 發行者裝載的資源群組。
- name - 使用此 NSD 部署的現有網路函數定義群組名稱。 如果您使用 CLI 發佈 NFDV,這會與 NF 名稱相同。
- version - 要以此 NSD 為基礎的現有網路函式定義版本。 此 NSD 能夠部署任何與這個版本相容的部署參數的 NFDV。
- publisher_offering_location - 發佈 NFDV 的區域。
- type - 網路函式的類型。 有效值為 cnf 或 vnf。
建置網路服務設計版本 (NSDV)
使用下列命令起始 NSDV 的建置程式:
az aosm nsd build -f input-cnf-nsd.jsonc
建置程式會產生名為 nsd-cli-output
的資料夾。 建置程式完成之後,請檢閱產生的檔案,以深入瞭解 NSDV 架構和結構,以及相關聯的資源。
這些檔案會建立:
目錄/檔案 | 描述 |
---|---|
nsdDefinition/config-group-schema.json | 定義從這個 NSDV 建立站台網路服務 (SNS) 所需的部署參數架構。 |
nsdDefinition/nginx-nsd-mappings.json | 地圖 NSDV 的參數到 NF ARM 範本所需的值。 |
nsdDefinition/deploy.bicep | 用於建立 NSDV 本身的 Bicep 範本。 |
artifacts | 包含 NF ARM 範本的 bicep 範本,以及要包含在成品指令清單中的成品清單。 |
artifactManifest/deploy.bicep | 用於建立成品指令清單的 Bicep 範本。 |
base/deploy.bicep | 用於建立發行者、網路服務設計群組和成品存放區的 Bicep 範本 |
發佈網路服務設計版本 (NSDV)
若要發佈 NSDV 及其相關聯的成品,請發出下列命令:
az aosm nsd publish --build-output-folder nsd-cli-output
當發佈程式完成時,流覽至您的發行者資源群組,以觀察並檢閱產生的資源和成品。