|
3 | 3 |
|
4 | 4 | Monitoring and logging are integral aspects of managing and maintaining Azure Kubernetes Services (AKS) in {product}. With features like Managed Prometheus Monitoring and Azure Monitor integration, administrators can efficiently monitor resource utilization, diagnose issues, and ensure the reliability of their containerized workloads. |
5 | 5 |
|
| 6 | +== Enabling Azure Monitor Metrics |
| 7 | + |
6 | 8 | To enable Managed Prometheus Monitoring, use the `-enable-azure-monitor-metrics` option within either the `az aks create` or `az aks update` command, depending on whether you're creating a new cluster or updating an existing one, such as: |
7 | 9 |
|
8 | 10 | [source,bash] |
9 | 11 | ---- |
10 | 12 | az aks create/update --resource-group <your-ResourceGroup> --name <your-Cluster> --enable-azure-monitor-metrics |
11 | 13 | ---- |
12 | 14 |
|
13 | | -The previous command installs the metrics add-on, which gathers https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/prometheus-metrics-overview[Prometheus metrics]. Using the previous command, you can enable monitoring of Azure resources through both native Azure Monitor metrics and Prometheus metrics. You can also view the results in the portal under *Monitoring -> Insights*. For more information, see https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/monitor-azure-resource[Monitor Azure resources with Azure Monitor]. |
| 15 | +The previous command installs the metrics add-on, which gathers https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/prometheus-metrics-overview[Prometheus metrics]. Using the previous command, you can enable monitoring of Azure resources through both native Azure Monitor metrics. You can also view the results in the portal under *Monitoring -> Insights*. For more information, see https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/monitor-azure-resource[Monitor Azure resources with Azure Monitor]. |
14 | 16 |
|
15 | 17 | Furthermore, metrics from both the Managed Prometheus service and Azure Monitor can be accessed through Azure Managed Grafana service. For more information, see https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/azure-monitor-workspace-manage?tabs=azure-portal#link-a-grafana-workspace[Link a Grafana workspace] section. |
16 | 18 |
|
17 | 19 | By default, Prometheus uses the minimum ingesting profile, which optimizes ingestion volume and sets default configurations for scrape frequency, targets, and metrics collected. The default settings can be customized through custom configuration. Azure offers various methods, including using different ConfigMaps, to provide scrape configuration and other metric add-on settings. For more information about default configuration, see https://learn.microsoft.com/en-us/azure/azure-monitor/containers/prometheus-metrics-scrape-default[Default Prometheus metrics configuration in Azure Monitor] and https://learn.microsoft.com/en-us/azure/azure-monitor/containers/prometheus-metrics-scrape-configuration?tabs=CRDConfig%2CCRDScrapeConfig[Customize scraping of Prometheus metrics in Azure Monitor managed service for Prometheus] documentation. |
18 | 20 |
|
| 21 | +== Configuring annotations for monitoring |
| 22 | + |
| 23 | +You can configure the annotations for monitoring {product} specific metrics in both Helm deployment and Operator-backed deployment. |
| 24 | + |
| 25 | +Helm deployment:: |
| 26 | ++ |
| 27 | +-- |
| 28 | +To annotate the backstage pod for monitoring, update your `values.yaml` file as follows: |
| 29 | + |
| 30 | +[source,yaml] |
| 31 | +---- |
| 32 | +upstream: |
| 33 | + backstage: |
| 34 | + # --- TRUNCATED --- |
| 35 | + podAnnotations: |
| 36 | + prometheus.io/scrape: 'true' |
| 37 | + prometheus.io/path: '/metrics' |
| 38 | + prometheus.io/port: '9464' |
| 39 | + prometheus.io/scheme: 'http' |
| 40 | +---- |
| 41 | +-- |
| 42 | + |
| 43 | +Operator-backed deployment:: |
| 44 | ++ |
| 45 | +-- |
| 46 | +.Procedure |
| 47 | + |
| 48 | +. As an administrator of the operator, edit the default configuration to add Prometheus annotations as follows: |
| 49 | ++ |
| 50 | +[source,bash] |
| 51 | +---- |
| 52 | +# Update OPERATOR_NS accordingly |
| 53 | +OPERATOR_NS=rhdh-operator |
| 54 | +kubectl edit configmap backstage-default-config -n "${OPERATOR_NS}" |
| 55 | +---- |
| 56 | + |
| 57 | +. Find the `deployment.yaml` key in the ConfigMap and add the annotations to the `spec.template.metadata.annotations` field as follows: |
| 58 | ++ |
| 59 | +[source,yaml] |
| 60 | +---- |
| 61 | +deployment.yaml: |- |
| 62 | + apiVersion: apps/v1 |
| 63 | + kind: Deployment |
| 64 | + # --- truncated --- |
| 65 | + spec: |
| 66 | + template: |
| 67 | + # --- truncated --- |
| 68 | + metadata: |
| 69 | + labels: |
| 70 | + rhdh.redhat.com/app: # placeholder for 'backstage-<cr-name>' |
| 71 | + # --- truncated --- |
| 72 | + annotations: |
| 73 | + prometheus.io/scrape: 'true' |
| 74 | + prometheus.io/path: '/metrics' |
| 75 | + prometheus.io/port: '9464' |
| 76 | + prometheus.io/scheme: 'http' |
| 77 | + # --- truncated --- |
| 78 | +---- |
| 79 | + |
| 80 | +. Save your changes. |
| 81 | +-- |
| 82 | + |
| 83 | +.Verification |
| 84 | + |
| 85 | +To verify if the scraping works, navigate to the corresponding Azure Monitor Workspace and view the metrics under *Monitoring -> Metrics*. |
| 86 | + |
| 87 | + |
19 | 88 | == Viewing logs with Azure Kubernetes Services (AKS) |
20 | 89 |
|
21 | 90 | You can access live data logs generated by Kubernetes objects and collect log data in Container Insights within AKS. |
|
0 commit comments