共用方式為


設定 Azure Kubernetes Service 的 Azure 應用程式組態 擴充功能 (預覽版)

建立 Azure 應用程式組態 擴充功能之後,您可以使用各種組態選項來設定擴充功能,以最適合您和專案使用:

  • 設定複本計數。
  • 設定記錄詳細資訊。
  • 設定安裝命名空間。

擴充功能可讓您使用 --configuration-settings Azure CLI 中的 參數來設定 Azure 應用程式組態 擴充功能設定。

提示

如需可用選項的清單,請參閱 Azure 應用程式組態 Kubernetes 提供者 helm 值

設定複本計數

預設複本計數為 1。 使用自訂複本計數建立 Azure 應用程式組態 擴充功能:

az k8s-extension create --cluster-type managedClusters \
    --cluster-name myAKSCluster \
    --resource-group myResourceGroup \
    --name appconfigurationkubernetesprovider \
    --extension-type Microsoft.AppConfiguration \
    --auto-upgrade-minor-version true \
    --configuration-settings "replicaCount=3"

注意

如果組態設定很敏感,而且必須受到保護(例如憑證相關信息),請傳遞 --configuration-protected-settings 參數,且值將受到保護,以免被讀取。

設定記錄詳細資訊

預設的記錄詳細資訊為 1。 使用自訂的記錄詳細資訊建立 Azure 應用程式組態 擴充功能:

az k8s-extension create --cluster-type managedClusters \
    --cluster-name myAKSCluster \
    --resource-group myResourceGroup \
    --name appconfigurationkubernetesprovider \
    --extension-type Microsoft.AppConfiguration \
    --auto-upgrade-minor-version true \
    --configuration-settings "logVerbosity=3"

記錄詳細資訊層級遵循 klog 慣例:

  • 0:僅限警告和錯誤。
  • 1:資訊,此層級為預設值。
  • 2:詳細的穩定狀態資訊。
  • 3:關於變更的擴充資訊。
  • 4:偵錯層級詳細資訊。
  • 5:追蹤層級詳細資訊。

設定 Azure 應用程式組態擴充命名空間

根據預設,Azure 應用程式組態 擴充功能會安裝在 命名空間中azappconfig-system。 若要將其覆寫,請使用 --release-namespace。 包括叢集 --scope 以重新定義命名空間。

az k8s-extension create --cluster-type managedClusters \
    --cluster-name myAKSCluster \
    --resource-group myResourceGroup \
    --name appconfigurationkubernetesprovider \
    --extension-type Microsoft.AppConfiguration \
    --auto-upgrade-minor-version true \
    --scope cluster \
    --release-namespace custom-namespace

顯示目前的組態設定

az k8s-extension show使用 命令來顯示目前的 Azure 應用程式組態 擴充功能設定:

az k8s-extension show --cluster-type managedClusters \
    --cluster-name myAKSCluster \
    --resource-group myResourceGroup \
    --name appconfigurationkubernetesprovider

更新組態設定

若要更新您的 Azure 應用程式組態 擴充功能設定,請重新建立具有所需狀態的擴充功能。 例如,假設我們已使用下列組態來安裝擴充功能:

az k8s-extension create --cluster-type managedClusters \
    --cluster-name myAKSCluster \
    --resource-group myResourceGroup \
    --name appconfigurationkubernetesprovider \
    --extension-type Microsoft.AppConfiguration \
    --auto-upgrade-minor-version true \  
    --configuration-settings "replicaCount=2" 

若要將 replicaCount 從兩個更新為三個,請使用下列命令:

az k8s-extension create --cluster-type managedClusters \
    --cluster-name myAKSCluster \
    --resource-group myResourceGroup \
    --name appconfigurationkubernetesprovider \
    --extension-type Microsoft.AppConfiguration \
    --auto-upgrade-minor-version true \
    --configuration-settings "replicaCount=3"

後續步驟

在 AKS 叢集中成功安裝 Azure 應用程式組態 擴充功能之後,請嘗試快速入門以瞭解如何使用它。