高規模模式是 Container Insights 中的一項功能,讓你能以高吞吐量從 Azure Kubernetes Service (AKS) 叢集節點收集容器主控台(stdout 與 stderr)日誌。 此功能可讓您收集每個節點最多 50,000 個記錄/秒。
Overview
啟用高規模模式時,容器深入解析會執行多個設定變更,進而產生較高的整體吞吐量。 這包括使用升級版的代理程式和 Azure 監視器 資料管線,並進行擴展性改進。 這些變更都是由 Azure 監視器 在背景進行的,啟用功能後不需要輸入或設定。
高縮放模式只會影響資料收集層。 其餘的 Container Insights 體驗會維持不變,記錄會內嵌到相同的 ContainerLogV2 數據表中。 現有的查詢和警示會繼續運作,因為會收集相同的資料。
若要達到最大支援的記錄輸送量,您應該針對 AKS 叢集節點使用具有 16 個以上 CPU 核心的高階 VM SKU。 使用低規格 VM 型號會影響您的日誌吞吐量。
我的叢集是否符合資格?
大規模記錄收集適合在其 Kubernetes 叢集中針對每個節點傳送超過 2,000 個記錄/秒 (或 2 MB/秒),且已針對每個節點傳送最多 50,000 個記錄/秒而設計及測試的環境。 使用下列記錄查詢來判斷您的叢集是否適合大規模記錄收集。
每秒和每個節點的記錄數
ContainerLogV2
| where _ResourceId =~ "<cluster-resource-id>"
| summarize count() by bin(TimeGenerated, 1s), Computer
| render timechart
每秒每個節點的記錄大小 (以 MB 為單位)
ContainerLogV2
| where _ResourceId =~ "<cluster-resource-id>"
| summarize BillableDataMB = sum(_BilledSize)/1024/1024 by bin(TimeGenerated, 1s), Computer
| render timechart
Prerequisites
- Azure CLI 版本 2.74.0 或更高。
- 若您是管理已啟用 Azure Arc 的 Kubernetes,則為 Azure CLI k8s-extension 1.6.7 版或更新版本。
- 叢集結構描述必須針對 ContainerLogV2 進行設定。
- 如果 ama-logs daemon set 容器的預設資源限制(CPU 和記憶體)不符合你的日誌規模需求,請聯絡 Microsoft 支援管道,提高 ama-log 容器的資源限制。
網路防火牆需求
除了監控 Kubernetes 叢集的 網路防火牆需求 之外,還需要根據您的雲端環境進行下表中的其他設定,以啟用高擴展模式。
| Cloud | Endpoint | Port |
|---|---|---|
| Azure Public Cloud | <dce-name>-<suffix>.<cluster-region-name>-<suffix>.ingest.monitor.azure.com |
443 |
| Microsoft Azure 由 21Vianet cloud 運作 | <dce-name>-<suffix>.<cluster-region-name>-<suffix>.ingest.monitor.azure.cn |
443 |
| Azure Government 雲端 | <dce-name>-<suffix>.<cluster-region-name>-<suffix>.ingest.monitor.azure.us |
443 |
端點是叢集所使用資料收集規則 (DCR) 之資料收集端點 (DCE) 的記錄擷取端點。 當您啟用叢集的高縮放模式,並以 前置 MSCI-ingest詞 開頭時,就會建立此 DCE。
Limitations
不支援下列案例:
- 具有受信任憑證的 HTTP Proxy
- 在 Azure 入口網站上進行入門
- 透過 AKS Insights 入口網站體驗中的 [監視設定] 進行設定
- 從現有的容器深入解析自動移轉
- 使用 Bicep、Terraform 和 Azure 原則 對 Azure Arc 啟用的 Kubernetes 進行入門操作
啟用大規模記錄收集
請遵循下列各節中的兩個步驟,為您的叢集啟用高縮放模式。
Note
高記錄縮放模式需要資料收集端點 (DCE) 才能進行擷取。 當您將 DCE 上線時,系統會以每個叢集的前置詞 MSCI-ingest 建立擷取 DCE。 如果配置了 Azure 監視器 私人連線範圍,那麼也會建立一個前綴為 MSCI-config 的 DCE 配置。
更新配置地圖
第一個步驟是更新叢集的 configmap,以指示容器深入解析 ama-logs deamonset Pod 以高縮放模式執行。
請遵循設定及部署 ConfigMap 中的指導,下載並更新叢集的 ConfigMap。
透過
agent-settings底下的下列設定來啟用高縮放模式。[agent_settings.high_log_scale] enabled = true啟用內部計量的集合,以在
agent-settings下方的下列設定中填入以下所述的 QoS Grafana 儀錶板。[agent_settings.fbit_config] enable_internal_metrics = "true"使用下列命令將 ConfigMap 套用至叢集。
kubectl config set-context <cluster-name> kubectl apply -f <configmap_yaml_file.yaml>
套用此 configmap 之後,ama-logs-* Pod 會自動重新啟動,並將 ama-logs daemonset Pod 設定為以高縮放模式執行。
啟用監視附加元件的高縮放模式
使用以下 Azure CLI 命令啟用大規模模式的監控附加元件,以根據 AKS 組態啟用監控附加元件的大規模記錄模式。
Note
請參閱 Enable Container Insights 有關啟用 Container Insights 及其他方法(如 ARM、Bicep 和 Terraform)的指引。 要啟用高尺度模式,請在Microsoft-ContainerLogV2-HighScale參數中使用 Microsoft-ContainerLogV2,而非如 streams 所述的 。
現有的 AKS 叢集
az aks enable-addons -a monitoring -g <resource-group-name> -n <cluster-name> --workspace-resource-id <workspace-resource-id> --enable-high-log-scale-mode
現有的 AKS 私有叢集
az aks enable-addons -a monitoring -g <resource-group-name> -n <cluster-name> --workspace-resource-id <workspace-resource-id> --enable-high-log-scale-mode --ampls-resource-id /subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/microsoft.insights/privatelinkscopes/<resourceName>
新的 AKS 叢集
az aks create -g <resource-group-name> -n <cluster-name> --enable-addons monitoring --workspace-resource-id <workspace-resource-id> --enable-high-log-scale-mode
新的 AKS 私人叢集
詳見 Create a private Azure Kubernetes Service (AKS)cluster 了解如何建立 AKS 私有叢集。 使用額外的參數 --enable-high-scale-mode 和 --ampls-resource-id 來設定大規模記錄模式與 Azure 監視器私人連結範圍資源 ID。
已啟用 ARC 的叢集
az k8s-extension create --name azuremonitor-containers --resource-group <resource-group-name> --cluster-name <cluster-name> --cluster-type connectedClusters --extension-type Microsoft.AzureMonitor.Containers --configuration-settings amalogs.enableHighLogScaleMode=true logAnalyticsWorkspaceResourceID=<workspace-resource-id>
Migration
如果已為您的叢集啟用 Container Insights,則您必須將其停用,然後使用高擴展模式重新啟用它。
- 由於高延展模式使用不同的數據管線,因此您必須確定管線端點不會遭到防火牆或其他網路聯機封鎖。
- 除了資料收集的標準 DCR 之外,高縮放模式還需要資料收集端點 (DCE) 才能進行擷取。 如果你建立了任何使用
Microsoft-ContainerLogV2的 DCR,必須用Microsoft-ContainerLogV2-HighScale取代,否則資料會被重複。 如果 DCR 尚未使用 DCR,您也應該建立 DCE 進行擷取,並將其連結至 DCR。 參考 Azure Resource Manager 中的 Container Insights 上線指南,以檢視依賴項的參考資料。
使用 Prometheus 和 Grafana 監視 QoS 計量
當產生的記錄量相當龐大時,可能會導致節流和記錄遺失。 如需設定節流參數及監視記錄遺失的指引,請參閱 Container Insights 的節流設定 文章。