本文將引導使用者管理 Azure Operator 服務管理器的網路功能操作員 (NFO) 擴充功能。 您可以使用此 Kubernetes 叢集延伸模組來管理 Azure 操作員連接點平台裝載的容器型工作負載。
您可以在讓 Nexus Azure Kubernetes Service (NAKS) 叢集準備好使用附加元件延伸模組之後,執行本文中的命令。 這些命令會假設先前將 Azure CLI 安裝到目標訂用帳戶中,並進行驗證。
建立 NFO 延伸模組
若要建立 NFO 延伸模組,請執行 Azure CLI 命令 az k8s-extension create。
命令
az k8s-extension create --cluster-name
--cluster-type {connectedClusters}
--extension-type {Microsoft.Azure.HybridNetwork}
--name
--resource-group
--scope {cluster}
--release-namespace {azurehybridnetwork}
--release-train {preview, stable}
--config Microsoft.CustomLocation.ServiceAccount=azurehybridnetwork-networkfunction-operator
[--auto-upgrade {false, true}]
[--config global.networkfunctionextension.enableClusterRegistry={false, true}]
[--config global.networkfunctionextension.enableLocalRegistry={false, true}]
[--config global.networkfunctionextension.enableEarlyLoading={false,true}]
[--config global.networkfunctionextension.clusterRegistry.highAvailability.enabled={true, false}]
[--config global.networkfunctionextension.clusterRegistry.autoScaling.enabled={true, false}]
[--config global.networkfunctionextension.webhook.highAvailability.enabled={true, false}]
[--config global.networkfunctionextension.webhook.autoScaling.enabled={true, false}]
[--config global.networkfunctionextension.clusterRegistry.storageClassName=]
[--config global.networkfunctionextension.clusterRegistry.storageSize=]
[--config global.networkfunctionextension.webhook.pod.mutation.matchConditionExpression=]
[--config global.networkfunctionextension.clusterRegistry.clusterRegistryGCCadence=]
[--config global.networkfunctionextension.clusterRegistry.clusterRegistryGCThreshold=]
[--config global.networkfunctionextension.clusterRegistry.registryService.scale={"small", "medium", "large"}]
[--version]
必要參數
--cluster-name -c
- Kubernetes 叢集的名稱。
--cluster-type -t
- 指定 Azure Arc 叢集、Azure Kubernetes Service (AKS) 受控叢集、Azure Arc 設備或
provisionedClusters。 - 接受的值:
connectedClusters。
--extension-type
- 延伸模組類型的名稱。
- 接受的值:
Microsoft.Azure.HybridNetwork。
--name -n
- 擴充功能實例的名稱。
--resource-group -g
- 資源群組的名稱。 您可以使用
az configure --defaults group=groupname來設定預設群組。
--config Microsoft.CustomLocation.ServiceAccount=azurehybridnetwork-networkfunction-operator
- 您必須提供此組態。
選擇性參數
--auto-upgrade
- 自動升級延伸模組執行個體的次要版本。
- 接受的值:
false、true。 - 預設值:
true。
--release-train
- 指定延伸模組類型的發行定型。
- 接受的值:
preview、stable。 - 預設值:
stable。
--version
- 如果
--auto-upgrade-minor-version未啟用,請指定要為延伸模組執行個體安裝的明確版本。
選擇性功能專用配置
側載
--config global.networkfunctionextension.enableLocalRegistry=
- 此配置允許通過硬件驅動器將成品傳遞到邊緣。
- 接受的值:
false、true。 - 預設值:
false。
Pod 變動 Webhook
--config global.networkfunctionextension.webhook.pod.mutation.matchConditionExpression=
此組態是選擇性參數。 只有在容器網路功能 (CNF) 安裝在對應的發行命名空間中時,才會使用。
此設定會在規則和
namespaceSelectors之上設定更精細的控制。預設值:
"((object.metadata.namespace != \"kube-system\") || (object.metadata.namespace == \"kube-system\" && has(object.metadata.labels) && (has(object.metadata.labels.app) && (object.metadata.labels.app == \"commissioning\") || (has(object.metadata.labels.name) && object.metadata.labels.name == \"cert-exporter\") || (has(object.metadata.labels.app) && object.metadata.labels.app == \"descheduler\"))))"參考的比對條件意味著,只有當 Pod 至少具有以下其中一個標籤時,才會對
kube-system命名空間中被接受的 Pod 進行變動:app == "commissioning"、app == "descheduler"或name == "cert-exporter"。 否則,它們不會被變動,且會繼續根據 CNF、元件或應用程式的 Helm Chart 來從原始來源中進行提取。接受的值:任何有效的通用運算式語言 (CEL) 運算式。
您可以在安裝或更新 NFO 延伸模組期間設定或更新此參數。
只有當您根據規則 和
namespaceSelectors將 CNF、元件或應用程式安裝到命名空間時,此條件才會發揮作用。 如果您在該命名空間中建立更多 Pod,則會套用此條件。
叢集登錄
--config global.networkfunctionextension.enableClusterRegistry=
- 此組態會將叢集中的登錄佈建到本機快取成品。
- 預設值會啟用延遲載入模式,除非
global.networkfunctionextension.enableEarlyLoading=true。 - 接受的值:
false、true。 - 預設值:
false。
--config global.networkfunctionextension.clusterRegistry.highAvailability.enabled=
- 如果已啟用叢集登錄,此組態會在高可用性 (HA) 模式下佈建叢集登錄。
- 如果值設定為
false,則此組態會根據 AKS 建議使用 NAKSnexus-shared磁碟區。 - 登錄 Pod 複本計數的最小
3值和最大5值為 。 - 接受的值:
true、false。 - 預設值:
true。
--config global.networkfunctionextension.clusterRegistry.autoScaling.enabled=
- 此組態會為叢集登錄 Pod 佈建水平自動調整功能。
- 接受的值:
true、false。 - 預設值:
true。
--config global.networkfunctionextension.webhook.highAvailability.enabled=
- 此組態會佈建 Webhook 的多個複本,以實現高可用性。
- 接受的值:
true、false。 - 預設值:
true。
--config global.networkfunctionextension.webhook.autoScaling.enabled=
- 此組態會為 Webhook Pod 佈建水平自動調整功能。
- 接受的值:
true、false。 - 預設值:
true。
--config global.networkfunctionextension.enableEarlyLoading=
- 此組態可讓您在 Helm 安裝或升級之前,儘早將構件載入叢集登錄。
- 只有在
global.networkfunctionextension.enableClusterRegistry=true的時候,您才能啟用此組態。 - 接受的值:
false、true。 - 預設值:
false。
--config global.networkfunctionextension.clusterRegistry.storageClassName=
- 您必須在
global.networkfunctionextension.enableClusterRegistry=true時提供此組態。 -
networkfunctionextension會為來自此儲存類別的本機快取成品佈建持續性磁碟區宣告 (PVC)。 - 平台特定值:
- AKS:
managed-csi - NAKS(預設):
nexus-shared - NAKS (非高可用性):
nexus-volume - Azure Stack Edge:
managed-premium
- AKS:
- 預設值:
nexus-shared。
附註
- 當您使用 Azure 操作員服務管理員管理 NAKS 叢集時,預設參數值會啟用 HA 作為建議的設定。
- 當您使用 Azure 操作員服務管理員管理 AKS 叢集時,您必須使用下列設定選項來停用 HA:
--config global.networkfunctionextension.clusterRegistry.highAvailability.enabled=false
--config global.networkfunctionextension.webhook.highAvailability.enabled=false
--config global.networkfunctionextension.clusterRegistry.storageClassName=managed-csi
--config global.networkfunctionextension.clusterRegistry.storageSize=
- 在
global.networkfunctionextension.enableClusterRegistry=true時,您必須提供此組態。 - 此組態會設定我們為叢集登錄保留的大小。
- 此配置採用 GiB 和 TiB 作為單位來進行大小調整。
- 預設值:
100Gi
--config global.networkfunctionextension.clusterRegistry.clusterRegistryGCCadence=
- 您必須以標準 Unix Crontab 格式提供此組態作為排程。
- 此組態 (指定為空字串) 會停用排程工作,以便您可以選擇不執行垃圾收集。
- 預設值:
0 0 * * *。 每天執行一次任務。
--config global.networkfunctionextension.clusterRegistry.clusterRegistryGCThreshold=
- 此配置指定百分比臨界值,以觸發叢集註冊表的垃圾收集處理程序。
- 當叢集登錄使用量超過此值時,此設定會觸發記憶體回收程序。
- 預設值:
0。
--config global.networkfunctionextension.clusterRegistry.registryService.scale=
此組態會將叢集登錄的 CPU 和記憶體資源設定為預先定義的調整選項。
接受的值:
small、、。mediumlarge預設值:
medium。以下是所有三個規模的登錄資源規格:
- requests: - small: cpu: 100m, memory: 250Mi - medium: cpu: 250m, memory: 500Mi - large: cpu: 500m, memory: 1Gi - limits: - small: cpu: 100m, memory: 2Gi - medium: cpu: 500m, memory: 2Gi - large: cpu: 1, memory: 4Gi
更新 NFO 擴充功能
若要更新 NFO 延伸模組,請執行 Azure CLI 命令 az k8s-extension update:
az k8s-extension update --resource-group
--cluster-name
--cluster-type {connectedClusters}
--extension-type {Microsoft.Azure.HybridNetwork}
--name
--release-namespace {azurehybridnetwork}
--release-train {preview, stable}
--config Microsoft.CustomLocation.ServiceAccount=azurehybridnetwork-networkfunction-operator
[--version] {version-target}
[--config global.networkfunctionextension.enableClusterRegistry={false, true}]
[--config global.networkfunctionextension.enableLocalRegistry={false, true}]
[--config global.networkfunctionextension.enableEarlyLoading={false,true}]
[--config global.networkfunctionextension.clusterRegistry.highAvailability.enabled={true, false}]
[--config global.networkfunctionextension.clusterRegistry.autoScaling.enabled={true, false}]
[--config global.networkfunctionextension.webhook.highAvailability.enabled={true, false}]
[--config global.networkfunctionextension.webhook.autoScaling.enabled={true, false}]
[--config global.networkfunctionextension.clusterRegistry.storageClassName=]
[--config global.networkfunctionextension.clusterRegistry.storageSize=]
[--config global.networkfunctionextension.webhook.pod.mutation.matchConditionExpression=]
[--config global.networkfunctionextension.clusterRegistry.clusterRegistryGCCadence=]
[--config global.networkfunctionextension.clusterRegistry.clusterRegistryGCThreshold=]
刪除 NFO 擴充功能
若要刪除 NFO 延伸模組,請執行 Azure CLI 命令 az k8s-extension delete:
az k8s-extension delete --resource-group
--cluster-name
--cluster-type {connectedClusters}
--extension-type {Microsoft.Azure.HybridNetwork}
--name
--release-namespace {azurehybridnetwork}
--release-train {preview, stable}
--config Microsoft.CustomLocation.ServiceAccount=azurehybridnetwork-networkfunction-operator
範例
建立具有自動升級的 NFO 延伸模組:
az k8s-extension create --resource-group myresourcegroup --cluster-name mycluster --name myextension --cluster-type connectedClusters --extension-type Microsoft.Azure.HybridNetwork --scope cluster --config Microsoft.CustomLocation.ServiceAccount=azurehybridnetwork-networkfunction-operator --release-namespace azurehybridnetwork
建立具有固定版本的 NFO 延伸模組:
az k8s-extension create --resource-group myresourcegroup --cluster-name mycluster --name myextension --cluster-type connectedClusters --extension-type Microsoft.Azure.HybridNetwork --auto-upgrade-minor-version false --scope cluster --config Microsoft.CustomLocation.ServiceAccount=azurehybridnetwork-networkfunction-operator --release-namespace azurehybridnetwork --version 1.0.2711-7
在 NAKS 上建立已啟用叢集登錄 (預設延遲載入模式) 功能的 NFO 延伸模組:
az k8s-extension create --resource-group myresourcegroup --cluster-name mycluster --name myextension --cluster-type connectedClusters --extension-type Microsoft.Azure.HybridNetwork --scope cluster --config Microsoft.CustomLocation.ServiceAccount=azurehybridnetwork-networkfunction-operator --release-namespace azurehybridnetwork --config global.networkfunctionextension.enableClusterRegistry=true --config global.networkfunctionextension.clusterRegistry.storageSize=100Gi
建立 NFO 延伸模組,並在 AKS 上啟用叢集登錄 (預設延遲載入模式) 功能:
az k8s-extension create --resource-group myresourcegroup --cluster-name mycluster --name myextension --cluster-type connectedClusters --extension-type Microsoft.Azure.HybridNetwork --scope cluster --config Microsoft.CustomLocation.ServiceAccount=azurehybridnetwork-networkfunction-operator --release-namespace azurehybridnetwork --config global.networkfunctionextension.enableClusterRegistry=true --config global.networkfunctionextension.clusterRegistry.highAvailability.enabled=false --config global.networkfunctionextension.clusterRegistry.storageClassName=managed-csi --config global.networkfunctionextension.clusterRegistry.storageSize=100Gi
建立已啟用叢集登錄 (早期載入) 功能的 NFO 延伸模組:
az k8s-extension create --resource-group myresourcegroup --cluster-name mycluster --name myextension --cluster-type connectedClusters --extension-type Microsoft.Azure.HybridNetwork --scope cluster --config Microsoft.CustomLocation.ServiceAccount=azurehybridnetwork-networkfunction-operator --release-namespace azurehybridnetwork --config global.networkfunctionextension.enableClusterRegistry=true --config global.networkfunctionextension.enableEarlyLoading=true --config global.networkfunctionextension.clusterRegistry.storageClassName=managed-csi --config global.networkfunctionextension.clusterRegistry.storageSize=100Gi
建立啟用側載功能的 NFO 擴充功能:
az k8s-extension create --resource-group myresourcegroup --cluster-name mycluster --name myextension --cluster-type connectedClusters --extension-type Microsoft.Azure.HybridNetwork --scope cluster --config Microsoft.CustomLocation.ServiceAccount=azurehybridnetwork-networkfunction-operator --release-namespace azurehybridnetwork --config global.networkfunctionextension.enableLocalRegistry=true
更新 NFO 延伸模組以啟用叢集登錄:
az k8s-extension update --resource-group naks-1-rg --cluster-name naks-1 --cluster-type connectedClusters --name networkfunction-operator --extension-type Microsoft.Azure.HybridNetwork --release-namespace azurehybridnetwork --config networkFunctionExtension.EnableManagedInClusterEdgeRegistry=true –-config networkFunctionExtension.EdgeRegistrySizeInGB=1024
更新 NFO 擴充功能以達到新的目標版本:
az k8s-extension update --resource-group naks-1-rg --cluster-name naks-1 --cluster-type connectedClusters --name networkfunction-operator --extension-type Microsoft.Azure.HybridNetwork --release-namespace azurehybridnetwork --version X.X.XXXX-YYY