本文說明如何使用下列 Azure 監視器功能,啟用 Kubernetes 叢集的完整監視:
- 計量集合的受控 Prometheus
- 記錄收集的容器深入解析
- 視覺效果的受控 Grafana。
使用 Azure 入口網站,您可以同時啟用所有功能。 您也可以使用 Azure CLI、Azure Resource Manager 範本、Terraform 或 Azure 原則個別啟用。 本文說明每個方式。
重要
Kubernetes 叢集會產生大量記錄資料,如果您對收集的記錄未多加選擇,可能會導致大量成本。 啟用叢集監視之前,請參閱下列文章以確保您的環境已針對成本進行最佳化,而且您將記錄收集限制為僅需要的資料:
- 使用資料收集規則在容器深入解析中設定資料收集和成本最佳化
啟用監視之後自訂記錄收集的詳細資料,包括使用預設成本最佳化組態。 - 使用 Azure 監視器監視 Kubernetes 的最佳做法
監視 Kubernetes 叢集的最佳做法,是按照 Azure Well-Architected Framework 五大要素進行整理,包括成本最佳化。 - Azure 監視器中的成本優化
設定 Azure 監視器所有功能的最佳做法,以將成本最佳化,並限制您收集的資料量。
支援的叢集
本文提供下列叢集類型的上線指引。 相關區段中會指出每個類型之程式的任何差異。
必要條件
權限
受控 Prometheus 必要條件
- 叢集必須使用受控識別驗證。
- 下列資源提供者必須在叢集和 Azure 監視器工作區的訂用帳戶中註冊:
- Microsoft.ContainerService(微軟容器服務)
- Microsoft.Insights
- Microsoft.AlertsManagement
- Microsoft.Monitor
- 下列資源提供者必須在 Grafana 工作區訂用帳戶中註冊:
- Microsoft.Dashboard
Arc 支援的 Kubernetes 叢集先決條件
- 除了已啟用 Azure Arc 的 Kubernetes 網路需求之外,請確認防火牆需求。
- 如果您先前已安裝適用於 AKS 的監視,請先確定您已停用監視,再繼續以避免在延伸模組安裝期間發生問題。
- 如果您先前使用不含叢集延伸模組的腳本在叢集上安裝監視,請遵循停用 Kubernetes 叢集監視的指示,刪除此 Helm 圖表。
附註
Managed Prometheus Arc-Enabled Kubernetes 擴充功能不支援下列設定:
- Red Hat OpenShift 版本,包括 Azure Red Hat OpenShift (ARO)
- Windows 節點*
*針對已啟用 ARC 的 Windows 節點叢集,您可以在叢集內的 Linux 節點上設定 Azure 受控 Prometheus,以及設定從 Windows 節點上執行的計量端點擷取計量。
工作區
下表描述支援 Managed Prometheus 和容器深入解析所需的工作區。 您可以將每個工作區建立為上線程式的一部分,或使用現有的工作區。 請參閱設計Log Analytics工作區架構,以取得要建立的工作區數目和放置位置的指引。
功能 | 工作區 | 備註 |
---|---|---|
受控 Prometheus | Azure 監視器工作區 | Contributor 權限足以讓附加元件將資料傳送至 Azure 監視器工作區。 連結 Azure 監視器工作區以檢視 Azure 受控 Grafana 中的計量時,您將需要 Owner 層級權限。 這是必要的,因為執行上線步驟的使用者必須能夠提供 Azure 受控 Grafana 系統識別 Monitoring Reader 角色在 Azure 監視器工作區上查詢計量。 |
容器深入解析 | Log Analytics 工作區 | 您可以將叢集連結至相同 Microsoft Entra 租使用者中不同 Azure 訂用帳戶中的 Log Analytics 工作區,但您必須使用 Azure CLI 或 Azure Resource Manager 範本。 您目前無法使用 Azure 入口網站執行此設定。 如果您要將現有的叢集連接到另一個訂用帳戶中的Log Analytics工作區,則必須在訂用帳戶中向Log Analytics工作區註冊 Microsoft.ContainerService 資源提供者。 如需更多資訊,請參閱註冊資源業者。 欲了解用於預設工作區的支援對應配對清單,請參閱容器深入解析支援的區域對應。 如需如何使用網路安全界限設定工作區的指引,請參閱使用網路安全界限設定 Azure 監視器。 |
受控 Grafana | Azure 受控 Grafana 工作區 | 將 Grafana 工作區連結至 Azure 監視器工作區,讓從叢集收集的 Prometheus 計量可供 Grafana 儀表板使用。 |
啟用 Prometheus 和 Grafana
使用下列其中一種方法,從叢集抓取 Prometheus 計量,並讓受控 Grafana 將計量可視化。 如需連結 Azure 監視器工作區和 Azure 受控 Grafana 工作區的選項,請參閱連結 Grafana 工作區。
重要
如果您使用範本或 Azure 原則進行部署,請確定已命名
MSProm-<Location of Azure Monitor Workspace>-<Name of cluster resource>
數據收集端點、數據收集規則和數據收集規則關聯,否則上線程式將無法順利完成。如果您有私人連結的單一 Azure 監視器資源,則如果 AKS 叢集和 Azure 監視器工作區位於不同區域,Prometheus 啟用將無法運作。 在相同的叢集區域中建立新的 DCE 和 DCRA。 將新的 DCE 與叢集產生關聯,並將新的 DCRA 命名為
configurationAccessEndpoint
。 請參閱 在 Azure 監視器中啟用 Kubernetes 監視的私人連結。
使用 CLI 啟用
如果您未在下列命令中指定現有的 Azure 監視器工作區,則會使用資源群組的預設工作區。 若叢集區域中還沒有預設工作區,則名稱格式為 DefaultAzureMonitorWorkspace-<mapped_region>
的工作區將在名稱為 DefaultRG-<cluster_region>
的資源群組建立。
必要條件
- Az CLI 的版本為 2.49.0 或更高版本。
- 必須使用命令 來從 AKS 叢集中解除安裝 "aks-preview" 擴充功能。
- 必須使用命令
az extension add --name k8s-extension
安裝 k8s-extension 擴充功能。 - 需要 k8s 延伸版本 1.4.1 版或更新版本。
選擇性參數
AKS 和 Arc-Enabled Kubernetes 的每個命令都允許下列選擇性參數。 每個參數名稱都不同,但其用法相同。
參數 | 名稱和描述 |
---|---|
註釋鍵 | AKS:--ksm-metric-annotations-allow-list Arc: --AzureMonitorMetrics.KubeStateMetrics.MetricAnnotationsAllowList Kubernetes 註解索引鍵的逗號分隔清單,要在資源的 kube_resource_annotations 計量中使用。 例如,kube_pod_annotations 是 Pod 資源的註釋計量。 根據預設,計量只包含名稱和命名空間標籤。 若要包含更多註釋,請提供資源名稱的複數形式列表以及您想為這些資源允許的 Kubernetes 註釋鍵。 您可以改為對於每個資源提供單一 * ,允許任何註釋,但會產生嚴重的效能影響。 例如: pods=[kubernetes.io/team,...],namespaces=[kubernetes.io/team],... 。 |
標籤索引鍵 | AKS:--ksm-metric-labels-allow-list Arc: --AzureMonitorMetrics.KubeStateMetrics.MetricLabelsAllowlist 以逗號分隔的更多 Kubernetes 標籤索引鍵清單,用於資源的 kube_resource_labels 計量 kube_resource_labels 計量。 例如,kube_pod_labels 是 pods 資源的標籤指標。 根據預設此計量只包含名稱和命名空間標籤。 若要包含更多標籤,請以複數形式提供資源名稱清單,以及您想要允許它們的 Kubernetes 標籤索引鍵:每個資源都可以提供單一 * 以允許任何標籤,但這具有嚴重的效能影響。 例如: pods=[app],namespaces=[k8s-label-1,k8s-label-n,...],... 。 |
錄製規則 | AKS:--enable-windows-recording-rules 可讓您啟用 Windows 儀錶板正常運作所需的錄製規則群組。 |
AKS 叢集
使用 -enable-azure-monitor-metrics
選項 az aks create
或 az aks update
(視您要建立新的叢集或更新現有叢集而定) 來安裝會抓取 Prometheus 計量的計量附加元件。
### Use default Azure Monitor workspace
az aks create/update --enable-azure-monitor-metrics --name <cluster-name> --resource-group <cluster-resource-group>
### Use existing Azure Monitor workspace
az aks create/update --enable-azure-monitor-metrics --name <cluster-name> --resource-group <cluster-resource-group> --azure-monitor-workspace-resource-id <workspace-name-resource-id>
### Use an existing Azure Monitor workspace and link with an existing Grafana workspace
az aks create/update --enable-azure-monitor-metrics --name <cluster-name> --resource-group <cluster-resource-group> --azure-monitor-workspace-resource-id <azure-monitor-workspace-name-resource-id> --grafana-resource-id <grafana-workspace-name-resource-id>
### Use optional parameters
az aks create/update --enable-azure-monitor-metrics --name <cluster-name> --resource-group <cluster-resource-group> --ksm-metric-labels-allow-list "namespaces=[k8s-label-1,k8s-label-n]" --ksm-metric-annotations-allow-list "pods=[k8s-annotation-1,k8s-annotation-n]"
已啟用 Arc 的叢集
### Use default Azure Monitor workspace
az k8s-extension create --name azuremonitor-metrics --cluster-name <cluster-name> --resource-group <resource-group> --cluster-type connectedClusters --extension-type Microsoft.AzureMonitor.Containers.Metrics
## Use existing Azure Monitor workspace
az k8s-extension create --name azuremonitor-metrics --cluster-name <cluster-name> --resource-group <resource-group> --cluster-type connectedClusters --extension-type Microsoft.AzureMonitor.Containers.Metrics --configuration-settings azure-monitor-workspace-resource-id=<workspace-name-resource-id>
### Use an existing Azure Monitor workspace and link with an existing Grafana workspace
az k8s-extension create --name azuremonitor-metrics --cluster-name <cluster-name> --resource-group <resource-group> --cluster-type connectedClusters --extension-type Microsoft.AzureMonitor.Containers.Metrics --configuration-settings azure-monitor-workspace-resource-id=<workspace-name-resource-id> grafana-resource-id=<grafana-workspace-name-resource-id>
### Use optional parameters
az k8s-extension create --name azuremonitor-metrics --cluster-name <cluster-name> --resource-group <resource-group> --cluster-type connectedClusters --extension-type Microsoft.AzureMonitor.Containers.Metrics --configuration-settings azure-monitor-workspace-resource-id=<workspace-name-resource-id> grafana-resource-id=<grafana-workspace-name-resource-id> AzureMonitorMetrics.KubeStateMetrics.MetricAnnotationsAllowList="pods=[k8s-annotation-1,k8s-annotation-n]" AzureMonitorMetrics.KubeStateMetrics.MetricLabelsAllowlist "namespaces=[k8s-label-1,k8s-label-n]"
下列額外的選擇性參數適用於已啟用 Azure Arc 的叢集:
參數 | 描述 | 預設 | 上游 Arc 叢集設定 |
---|---|---|---|
ClusterDistribution |
叢集的分佈。 | Azure.Cluster.Distribution |
是的 |
CloudEnvironment |
叢集的雲端環境。 | Azure.Cluster.Cloud |
是的 |
MountCATrustAnchorsDirectory |
是否要掛載 CA 信任錨點目錄。 | true |
否 |
MountUbuntuCACertDirectory |
是否要掛接Ubuntu CA 憑證目錄。 | true ,除非是 aks_edge 發行版本。 |
否 |
啟用容器深入解析
使用下列其中一種方法,在您的叢集上啟用容器深入解析。 完成之後,請參閱配置容器洞察的代理程式資料收集以自訂您的設定,確保您不會收集超過所需的資料。
重要
如果您有私人連結的單一 Azure 監視器資源,則無法使用 Azure 入口網站來啟用容器深入解析。 請參閱 在 Azure 監視器中啟用 Kubernetes 監視的私人連結。
若要使用網路安全界限啟用容器深入解析,請參閱使用網路安全界限設定 Azure 監視器以設定您的 Log Analytics 工作區。
使用下列其中一個命令來監視 AKS 和已啟用 Arc 的叢集。 如果您未指定現有的 Log Analytics 工作區,則會使用資源群組的預設工作區。 若叢集區域中還沒有預設工作區,則會使用格式為 DefaultWorkspace-<GUID>-<Region>
的名稱建立一個工作區。
必要條件
- Azure CLI 版本 2.43.0 版或更新版本
- CLI 2.49.0 版或更高版本中預設有受控識別驗證。
- Azure k8s 延伸版本 1.3.7 版或更新版本
- 受控識別驗證在 k8s-extension 1.43.0 版或更高版本中為預設。
- 已啟用 Arc 的 Kubernetes 叢集不支援使用 ARO (Azure Red Hat Openshift) 或 Windows 節點的受控識別驗證。 使用舊版驗證。
- 針對 CLI 2.54.0 版或更新版本,記錄結構描述將會使用 ConfigMap 設定為 ContainerLogV2。
附註
您可以使用叢集的資料收集規則 (DCR) 或 ConfigMap,為叢集啟用 ContainerLogV2 結構描述。 如果啟用這兩個設定,則 ConfigMap 會優先使用。 當 DCR 和 ConfigMap 明確設定為關閉時,Stdout 和 stderr 記錄只會內嵌至 ContainerLog 表格。
AKS 叢集
### Use default Log Analytics workspace
az aks enable-addons --addon monitoring --name <cluster-name> --resource-group <cluster-resource-group-name>
### Use existing Log Analytics workspace
az aks enable-addons --addon monitoring --name <cluster-name> --resource-group <cluster-resource-group-name> --workspace-resource-id <workspace-resource-id>
### Use legacy authentication
az aks enable-addons --addon monitoring --name <cluster-name> --resource-group <cluster-resource-group-name> --workspace-resource-id <workspace-resource-id> --enable-msi-auth-for-monitoring false
範例
az aks enable-addons --addon monitoring --name "my-cluster" --resource-group "my-resource-group" --workspace-resource-id "/subscriptions/my-subscription/resourceGroups/my-resource-group/providers/Microsoft.OperationalInsights/workspaces/my-workspace"
已啟用 Arc 的叢集
### Use default Log Analytics workspace
az k8s-extension create --name azuremonitor-containers --cluster-name <cluster-name> --resource-group <resource-group> --cluster-type connectedClusters --extension-type Microsoft.AzureMonitor.Containers
### Use existing Log Analytics workspace
az k8s-extension create --name azuremonitor-containers --cluster-name <cluster-name> --resource-group <resource-group> --cluster-type connectedClusters --extension-type Microsoft.AzureMonitor.Containers --configuration-settings logAnalyticsWorkspaceResourceID=<workspace-resource-id>
### Use managed identity authentication (default as k8s-extension version 1.43.0)
az k8s-extension create --name azuremonitor-containers --cluster-name <cluster-name> --resource-group <resource-group> --cluster-type connectedClusters --extension-type Microsoft.AzureMonitor.Containers --configuration-settings amalogs.useAADAuth=true
### Use advanced configuration settings
az k8s-extension create --name azuremonitor-containers --cluster-name <cluster-name> --resource-group <resource-group> --cluster-type connectedClusters --extension-type Microsoft.AzureMonitor.Containers --configuration-settings amalogs.resources.daemonset.limits.cpu=150m amalogs.resources.daemonset.limits.memory=600Mi amalogs.resources.deployment.limits.cpu=1 amalogs.resources.deployment.limits.memory=750Mi
### With custom mount path for container stdout & stderr logs
### Custom mount path not required for Azure Stack Edge version > 2318. Custom mount path must be /home/data/docker for Azure Stack Edge cluster with version <= 2318
az k8s-extension create --name azuremonitor-containers --cluster-name <cluster-name> --resource-group <resource-group> --cluster-type connectedClusters --extension-type Microsoft.AzureMonitor.Containers --configuration-settings amalogs.logsettings.custommountpath=<customMountPath>
檢視 Helm 圖表的資源要求和限制區段,以取得可用的組態設定。
範例
az k8s-extension create --name azuremonitor-containers --cluster-name "my-cluster" --resource-group "my-resource-group" --cluster-type connectedClusters --extension-type Microsoft.AzureMonitor.Containers --configuration-settings logAnalyticsWorkspaceResourceID="/subscriptions/my-subscription/resourceGroups/my-resource-group/providers/Microsoft.OperationalInsights/workspaces/my-workspace"
具有正向 Proxy 的已啟用 Arc 的叢集
如果已將叢集設為正向 Proxy,則 Proxy 設定會自動套用至延伸模組。 如果是具有 AMPLS + Proxy 的叢集,應該忽略 Proxy 設定。 使用組態設定 amalogs.ignoreExtensionProxySettings=true
將延伸模組上線。
az k8s-extension create --name azuremonitor-containers --cluster-name <cluster-name> --resource-group <resource-group> --cluster-type connectedClusters --extension-type Microsoft.AzureMonitor.Containers --configuration-settings amalogs.ignoreExtensionProxySettings=true
具有 ARO 或 OpenShift 或 Windows 節點的已啟用 Arc 的叢集
已啟用 Arc 的 Kubernetes 叢集不支援使用 ARO (Azure Red Hat OpenShift) 或 OpenShift 或 Windows 節點的受控識別驗證。 藉由指定 amalogs.useAADAuth=false
來使用舊版驗證,如下列範例所示。
az k8s-extension create --name azuremonitor-containers --cluster-name <cluster-name> --resource-group <resource-group> --cluster-type connectedClusters --extension-type Microsoft.AzureMonitor.Containers --configuration-settings amalogs.useAADAuth=false
刪除延伸模組執行個體
下列命令只會刪除延伸模組執行個體,但不會刪除 Log Analytics 工作區。 Log Analytics 資源內的資料會保持不變。
az k8s-extension delete --name azuremonitor-containers --cluster-type connectedClusters --cluster-name <cluster-name> --resource-group <resource-group>
使用 Azure 入口網站啟用完整監視
新的 AKS 叢集 (Prometheus、容器深入解析和 Grafana)
當您在 Azure 入口網站中建立新的 AKS 叢集時,預設會在 [監視] 索引標籤中核取 [啟用容器記錄]、[ 啟用 Prometheus 計量]、[ 啟用 Grafana] 和 [ 啟用建議的警示 ] 複選框。
現有 AKS 叢集 (Prometheus、容器深入解析和 Grafana)
- 在 Azure 入口網站中瀏覽至您的叢集。
- 在服務功能表中,選取 監視器>監視器設定。
- 系統會為您選取 Prometheus 指標、Grafana、容器記錄及事件。 如果您有現有的 Azure 監視器工作區、Grafana 工作區和 Log Analytics 工作區,則會為您選取它們。
- 如果您要選取替代工作區或建立新的工作區,請選取 [進階設定]。 [記錄配置檔] 和 [傳統配置檔] 設定可讓您修改預設集合詳細數據,以降低監視成本。 如需詳細資訊,請參閱在容器深入解析中啟用成本最佳化設定。
- 選取設定。
啟用 Windows 計量集合 (預覽)
附註
windows-exporter-daemonset.yaml 中沒有 CPU/儲存體限制,因此可能會過度佈建 Windows 節點
如需詳細資訊,請參閱資源保留
當您部署工作負載時,請設定容器的資源儲存體和 CPU 限制。 這也會從 NodeAllocatable 減去,並協助全叢集排程器判斷要放置於哪些節點上的 Pod。 排程沒有限制的 Pod 可能會過度佈建 Windows 節點,而且在極端情況下可能會導致節點變成狀況不良。
自 6.4.0-main-02-22-2023-3ee44b9e 受控 Prometheus 附加元件容器 (prometheus_collector) 起,已針對 AKS 叢集啟用 Windows 計量集合。 啟用 Azure 監視器度量附加元件可以使 Windows DaemonSet Pod 開始在您的節點集區上執行。 Windows Server 2019 和 Windows Server 2022 都有支援。 請遵循下列步驟,讓 Pod 從您的 Windows 節點集區收集計量。
藉由部署 windows-exporter-daemonset YAML 檔案,在 AKS 節點上手動安裝 Windows 匯出工具以存取 Windows 計量。 啟用下列收集器:
[defaults]
container
memory
process
cpu_info
如需更多收集器,請參閱 Windows 計量的 Prometheus 匯出工具。
部署 windows-exporter-daemonset YAML 檔案。 請注意,如果節點中套用了任何污點,您必須套用適當的容忍。
kubectl apply -f windows-exporter-daemonset.yaml
將 ama-metrics-settings-configmap 套用至您的叢集。 將
windowsexporter
與windowskubeproxy
布林值設定為true
。 如需更多資訊,請參閱 Metrics add-on settings configmap。開啟立即可用儀表板所需的錄製規則:
[僅適用於已啟用 ARC 之叢集中的 Windows 節點]如果您要為已啟用 ARC 的叢集啟用 Managed Prometheus,您可以設定在叢集內 Linux 節點上執行的 Managed Prometheus,以從 Windows 節點上執行的端點擷取計量。 將下列抓取工作新增至ama-metrics-prometheus-config-configmap.yaml,然後將該 configmap 套用到您的叢集。
scrape_configs:
- job_name: windows-exporter
scheme: http
scrape_interval: 30s
label_limit: 63
label_name_length_limit: 511
label_value_length_limit: 1023
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
insecure_skip_verify: true
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
kubernetes_sd_configs:
- role: node
relabel_configs:
- source_labels: [__meta_kubernetes_node_name]
target_label: instance
- action: keep
source_labels: [__meta_kubernetes_node_label_kubernetes_io_os]
regex: windows
- source_labels:
- __address__
action: replace
target_label: __address__
regex: (.+?)(\:\d+)?
replacement: $$1:9182
kubectl apply -f ama-metrics-prometheus-config-configmap.yaml
驗證部署
使用 kubectl 命令行工具 來確認代理程式是否已正確部署。
受控 Prometheus
確認 DaemonSet 已正確部署於 Linux 節點集區
kubectl get ds ama-metrics-node --namespace=kube-system
Pod 的數目應該等於叢集上的 Linux 節點數目。 輸出應類似下列範例:
User@aksuser:~$ kubectl get ds ama-metrics-node --namespace=kube-system
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
ama-metrics-node 1 1 1 1 1 <none> 10h
確認已正確部署 Windows 節點
kubectl get ds ama-metrics-win-node --namespace=kube-system
Pod 的數目應該等於叢集上的 Windows 節點數目。 輸出應類似下列範例:
User@aksuser:~$ kubectl get ds ama-metrics-node --namespace=kube-system
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
ama-metrics-win-node 3 3 3 3 3 <none> 10h
確認已針對 Prometheus 部署兩個 ReplicaSet
kubectl get rs --namespace=kube-system
輸出應類似下列範例:
User@aksuser:~$kubectl get rs --namespace=kube-system
NAME DESIRED CURRENT READY AGE
ama-metrics-5c974985b8 1 1 1 11h
ama-metrics-ksm-5fcf8dffcd 1 1 1 11h
容器深入解析
確認 DaemonSet 已正確部署於 Linux 節點集區
kubectl get ds ama-logs --namespace=kube-system
Pod 的數目應該等於叢集上的 Linux 節點數目。 輸出應類似下列範例:
User@aksuser:~$ kubectl get ds ama-logs --namespace=kube-system
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
ama-logs 2 2 2 2 2 <none> 1d
確認已正確部署 Windows 節點
kubectl get ds ama-logs-windows --namespace=kube-system
Pod 的數目應該等於叢集上的 Windows 節點數目。 輸出應類似下列範例:
User@aksuser:~$ kubectl get ds ama-logs-windows --namespace=kube-system
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
ama-logs-windows 2 2 2 2 2 <none> 1d
確認容器深入解析解決方案的部署
kubectl get deployment ama-logs-rs --namespace=kube-system
輸出應類似下列範例:
User@aksuser:~$ kubectl get deployment ama-logs-rs --namespace=kube-system
NAME READY UP-TO-DATE AVAILABLE AGE
ama-logs-rs 1/1 1 1 24d
使用 CLI 來檢視設定
使用 aks show
命令來了解解決方案已啟用、Log Analytics 工作區資源識別碼,以及叢集的摘要資訊。
az aks show --resource-group <resourceGroupofAKSCluster> --name <nameofAksCluster>
此命令會傳回解決方案的 JSON 格式資訊。 addonProfiles
區段應包含 omsagent
的相關資訊,如下列範例所示:
"addonProfiles": {
"omsagent": {
"config": {
"logAnalyticsWorkspaceResourceID": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourcegroups/my-resource-group/providers/microsoft.operationalinsights/workspaces/my-workspace",
"useAADAuth": "true"
},
"enabled": true,
"identity": null
},
}
已佈建的資源
當您按下啟用監視時,您的訂用帳戶中會建立下列資源:
資源名稱 | 資源類型 | 資源群組 | 區域/位置 | 描述 |
---|---|---|---|---|
MSCI-<aksclusterregion>-<clustername> |
資料收集規則 | 與叢集相同 | 與 Log Analytics 工作區相同 | 此資料收集規則適用於 Azure 監視器代理程式的記錄收集,此代理程式會使用 Log Analytics 工作區作為目的地,且與 AKS 叢集資源相關聯。 |
MSPROM-<aksclusterregion>-<clustername> |
資料收集規則 | 與叢集相同 | 與 Azure 監視器工作區相同 | 此資料收集規則適用於計量附加元件所收集的 Prometheus 計量,其已選擇的 Azure 監視器工作區作為目的地,也會與 AKS 叢集資源相關聯 |
MSPROM-<aksclusterregion>-<clustername> |
資料收集端點 | 與叢集相同 | 與 Azure 監視器工作區相同 | 上述資料收集規則會使用此資料收集端點,從計量附加元件擷取 Prometheus 計量 |
當您建立新的 Azure 監視器工作區時,會將下列其他資源建立為其中的一部分
資源名稱 | 資源類型 | 資源群組 | 區域/位置 | 描述 |
---|---|---|---|---|
<azuremonitor-workspace-name> |
資料收集規則 | MA_<azuremonitor-workspace-name>_<azuremonitor-workspace-region>_managed | 與 Azure 監視器工作區相同 | 當您使用 OSS Prometheus 伺服器遠端寫入至 Azure 監視器工作區時所建立的 DCR。 |
<azuremonitor-workspace-name> |
資料收集端點 | MA_<azuremonitor-workspace-name>_<azuremonitor-workspace-region>_managed | 與 Azure 監視器工作區相同 | 當您使用 OSS Prometheus 伺服器遠端寫入至 Azure 監視器工作區時所建立的 DCE。 |
Windows 叢集與 Linux 叢集之間的差異
監視 Windows Server 叢集和 Linux 叢集的主要差異包括:
- Windows 沒有記憶體 RSS 計量。 因此,不適用於 Windows 節點和容器。 工作集計量可供使用。
- 磁碟儲存體容量資訊不適用於 Windows 節點。
- 只會監視 Pod 環境,不監視 Docker 環境。
- 預覽版本最多支援 30 個 Windows Server 容器。 Linux 容器無此限制。
附註
Windows Server 2022 作業系統的容器深入解析支援現供預覽。
容器化 Linux 代理程式 (ReplicaSet Pod) 對叢集內 Kubelet 安全連接埠 (10250) 上的所有 Windows 節點進行 API 呼叫,以收集節點和容器效能相關計量。 Kubelet 安全連接埠 (:10250) 應該已在叢集的虛擬網路中開啟,Windows 節點和容器效能相關計量收集的輸入和輸出才能正常運作。
如果您有包含 Windows 節點的 Kubernetes 叢集,請檢閱並設定網路安全性群組和網路原則,確定已針對叢集虛擬網路中的輸入和輸出開啟 Kubelet 安全連接埠 (:10250)。