You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-monitor/containers/kubernetes-monitoring-enable.md
+22-18Lines changed: 22 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ This article describes how to enable complete monitoring of your Kubernetes clus
19
19
20
20
> [!IMPORTANT]
21
21
> Kubernetes clusters generate a lot of log data, which can result in significant costs if you aren't selective about the logs that you collect. Before you enable monitoring for your cluster, see the following articles to ensure that your environment is optimized for cost and that you limit your log collection to only the data that you require:
22
-
>
22
+
>
23
23
>-[Configure data collection and cost optimization in Container insights using data collection rule](./container-insights-data-collection-dcr.md)<br>Details on customizing log collection once you've enabled monitoring, including using preset cost optimization configurations.
24
24
>-[Best practices for monitoring Kubernetes with Azure Monitor](../best-practices-containers.md)<br>Best practices for monitoring Kubernetes clusters organized by the five pillars of the [Azure Well-Architected Framework](/azure/architecture/framework/), including cost optimization.
25
25
>-[Cost optimization in Azure Monitor](../best-practices-cost.md)<br>Best practices for configuring all features of Azure Monitor to optimize you costs and limit the amount of data that you collect.
@@ -76,16 +76,20 @@ The following table describes the workspaces that are required to support Manage
76
76
## Enable Prometheus and Grafana
77
77
Use one of the following methods to enable scraping of Prometheus metrics from your cluster and enable Managed Grafana to visualize the metrics. See [Link a Grafana workspace](../../managed-grafana/quickstart-managed-grafana-portal.md) for options to connect your Azure Monitor workspace and Azure Managed Grafana workspace.
78
78
79
+
> [!NOTE] If you have a single Azure Monitor Resource that is private-linked, then Prometheus enablement will not work if the AKS cluster and Azure Monitor Workspace are in different regions.
80
+
> The configuration needed for Prometheus add-on is not available cross region because of the private link constraint.
81
+
> To resolve this, just create a new DCE in the AKS cluster location and a new DCRA (association) in same AKS cluster region. Associate new dce with aks cluster and name the new association(DCRA) as configurationAccessEndpoint.
82
+
79
83
### [CLI](#tab/cli)
80
84
81
85
If you don't specify an existing Azure Monitor workspace in the following commands, the default workspace for the resource group will be used. If a default workspace doesn't already exist in the cluster's region, one with a name in the format `DefaultAzureMonitorWorkspace-<mapped_region>` will be created in a resource group with the name `DefaultRG-<cluster_region>`.
82
86
83
87
#### Prerequisites
84
88
85
-
- Az CLI version of 2.49.0 or higher is required.
86
-
- The aks-preview extension must be [uninstalled from AKS clusters](/cli/azure/azure-cli-extensions-overview) by using the command `az extension remove --name aks-preview`.
89
+
- Az CLI version of 2.49.0 or higher is required.
90
+
- The aks-preview extension must be [uninstalled from AKS clusters](/cli/azure/azure-cli-extensions-overview) by using the command `az extension remove --name aks-preview`.
87
91
- The k8s-extension extension must be installed using the command `az extension add --name k8s-extension`.
88
-
- The k8s-extension version 1.4.1 or higher is required.
92
+
- The k8s-extension version 1.4.1 or higher is required.
89
93
90
94
#### AKS cluster
91
95
Use the `-enable-azure-monitor-metrics` option `az aks create` or `az aks update` (depending whether you're creating a new cluster or updating an existing cluster) to install the metrics add-on that scrapes Prometheus metrics.
@@ -145,7 +149,7 @@ Both ARM and Bicep templates are provided in this section.
145
149
146
150
> [!NOTE]
147
151
> Currently in Bicep, there's no way to explicitly scope the `Monitoring Reader` role assignment on a string parameter "resource ID" for an Azure Monitor workspace like in an ARM template. Bicep expects a value of type `resource | tenant`. There is also no REST API [spec](https://github.com/Azure/azure-rest-api-specs) for an Azure Monitor workspace.
148
-
>
152
+
>
149
153
> Therefore, the default scoping for the `Monitoring Reader` role is on the resource group. The role is applied on the same Azure Monitor workspace by inheritance, which is the expected behavior. After you deploy this Bicep template, the Grafana instance is given `Monitoring Reader` permissions for all the Azure Monitor workspaces in that resource group.
150
154
151
155
@@ -241,7 +245,7 @@ If the Azure Managed Grafana instance is already linked to an Azure Monitor work
After the policy is assigned to the subscription, whenever you create a new cluster without Prometheus enabled, the policy will run and deploy to enable Prometheus monitoring.
560
+
After the policy is assigned to the subscription, whenever you create a new cluster without Prometheus enabled, the policy will run and deploy to enable Prometheus monitoring.
557
561
558
562
---
559
563
@@ -562,7 +566,7 @@ After the policy is assigned to the subscription, whenever you create a new clus
562
566
563
567
564
568
## Enable full monitoring with Azure portal
565
-
Using the Azure portal, you can enable both Managed Prometheus and Container insights at the same time.
569
+
Using the Azure portal, you can enable both Managed Prometheus and Container insights at the same time.
566
570
567
571
> [!NOTE]
568
572
> If you want to enabled Managed Prometheus without Container insights, then [enable it from the Azure Monitor workspace](./kubernetes-monitoring-enable.md#enable-prometheus-and-grafana) as described below.
@@ -575,7 +579,7 @@ When you create a new AKS cluster in the Azure portal, you can enable Prometheus
575
579
576
580
### Existing cluster (Prometheus and Container insights)
577
581
578
-
This option enables Container insights and optionally Prometheus and Grafana on an existing AKS cluster.
582
+
This option enables Container insights and optionally Prometheus and Grafana on an existing AKS cluster.
579
583
580
584
1. Either select **Insights** from the cluster's menu OR select **Containers** from the **Monitor** menu, **Unmonitored clusters** tab, and click **Enable** next to a cluster.
581
585
1. If Container insights isn't enabled for the cluster, then you're presented with a screen identifying which of the features have been enabled. Click **Configure monitoring**.
@@ -586,7 +590,7 @@ This option enables Container insights and optionally Prometheus and Grafana on
586
590
587
591
:::image type="content" source="media/aks-onboard/monitor-settings-button.png" lightbox="media/aks-onboard/monitor-settings-button.png" alt-text="Screenshot that shows the monitoring settings button for a cluster.":::
588
592
589
-
2. **Container insights** will be enabled. **Select** the checkboxes for **Enable Prometheus metrics** and **Enable Grafana** if you also want to enable them for the cluster. If you have existing Azure Monitor workspace and Grafana workspace, then they're selected for you.
593
+
2. **Container insights** will be enabled. **Select** the checkboxes for **Enable Prometheus metrics** and **Enable Grafana** if you also want to enable them for the cluster. If you have existing Azure Monitor workspace and Grafana workspace, then they're selected for you.
590
594
591
595
:::image type="content" source="media/prometheus-metrics-enable/configure-container-insights.png" lightbox="media/prometheus-metrics-enable/configure-container-insights.png" alt-text="Screenshot that shows the dialog box to configure Container insights with Prometheus and Grafana.":::
592
596
@@ -615,9 +619,9 @@ This option enables Prometheus metrics on a cluster without enabling Container i
615
619
## Enable Windows metrics collection (preview)
616
620
617
621
> [!NOTE]
618
-
> There is no CPU/Memory limit in windows-exporter-daemonset.yaml so it may over-provision the Windows nodes
622
+
> There is no CPU/Memory limit in windows-exporter-daemonset.yaml so it may over-provision the Windows nodes
619
623
> For more details see [Resource reservation](https://kubernetes.io/docs/concepts/configuration/windows-resource-management/#resource-reservation)
620
-
>
624
+
>
621
625
> As you deploy workloads, set resource memory and CPU limits on containers. This also subtracts from NodeAllocatable and helps the cluster-wide scheduler in determining which pods to place on which nodes.
622
626
> Scheduling pods without limits may over-provision the Windows nodes and in extreme cases can cause the nodes to become unhealthy.
623
627
@@ -632,7 +636,7 @@ As of version 6.4.0-main-02-22-2023-3ee44b9e of the Managed Prometheus addon con
632
636
* `memory`
633
637
* `process`
634
638
* `cpu_info`
635
-
639
+
636
640
For more collectors, please see [Prometheus exporter for Windows metrics](https://github.com/prometheus-community/windows_exporter#windows_exporter).
637
641
638
642
Deploy the [windows-exporter-daemonset YAML](https://github.com/prometheus-community/windows_exporter/blob/master/kubernetes/windows-exporter-daemonset.yaml) file:
@@ -779,14 +783,14 @@ When you enable monitoring, the following resources are created in your subscrip
779
783
|`MSCI-<aksclusterregion>-<clustername>`|**Data Collection Rule**| Same as cluster | Same as Log Analytics workspace | This data collection rule is for log collection by Azure Monitor agent, which uses the Log Analytics workspace as destination, and is associated to the AKS cluster resource. |
780
784
|`MSPROM-<aksclusterregion>-<clustername>`|**Data Collection Rule**| Same as cluster | Same as Azure Monitor workspace | This data collection rule is for prometheus metrics collection by metrics addon, which has the chosen Azure monitor workspace as destination, and also it is associated to the AKS cluster resource |
781
785
|`MSPROM-<aksclusterregion>-<clustername>`|**Data Collection endpoint**| Same as cluster | Same as Azure Monitor workspace | This data collection endpoint is used by the above data collection rule for ingesting Prometheus metrics from the metrics addon|
782
-
786
+
783
787
When you create a new Azure Monitor workspace, the following additional resources are created as part of it
784
788
785
789
| Resource Name | Resource Type | Resource Group | Region/Location | Description |
786
790
|:---|:---|:---|:---|:---|
787
791
|`<azuremonitor-workspace-name>`|**Data Collection Rule**| MA_\<azuremonitor-workspace-name>_\<azuremonitor-workspace-region>_managed | Same as Azure Monitor Workspace | DCR created when you use OSS Prometheus server to Remote Write to Azure Monitor Workspace. |
788
792
|`<azuremonitor-workspace-name>`|**Data Collection Endpoint**| MA_\<azuremonitor-workspace-name>_\<azuremonitor-workspace-region>_managed | Same as Azure Monitor Workspace | DCE created when you use OSS Prometheus server to Remote Write to Azure Monitor Workspace.|
0 commit comments