Skip to content

Commit 217c7b6

Browse files
Merge pull request #280691 from sunasing/sunasing-11july
Add steps to remote-write in Prometheus Operator
2 parents 77b4cad + a81ea64 commit 217c7b6

File tree

1 file changed

+63
-3
lines changed

1 file changed

+63
-3
lines changed

articles/azure-monitor/essentials/prometheus-remote-write-virtual-machines.md

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,12 @@ Onboarding to Azure Arc-enabled services allows you to manage and configure non-
4747
- Prometheus versions greater than v2.48 are required for Microsoft Entra ID application authentication.
4848

4949
### Azure Monitor workspace
50+
5051
This article covers sending Prometheus metrics to an Azure Monitor workspace. To create an Azure monitor workspace, see [Manage an Azure Monitor workspace](./azure-monitor-workspace-manage.md#create-an-azure-monitor-workspace).
5152

5253
## Permissions
53-
Administrator permissions for the cluster or resource are required to complete the steps in this article.
5454

55+
Administrator permissions for the cluster or resource are required to complete the steps in this article.
5556

5657
## Set up authentication for remote-write
5758

@@ -289,13 +290,70 @@ The output contains the `appId` and `password` values. Save these values to use
289290
For more information, see [az ad app create](/cli/azure/ad/app#az-ad-app-create) and [az ad sp create-for-rbac](/cli/azure/ad/sp#az-ad-sp-create-for-rbac).
290291

291292
---
293+
292294
## Configure remote-write
293295

294-
Remote-write is configured in the Prometheus configuration file `prometheus.yml`.
296+
Remote-write is configured in the Prometheus configuration file `prometheus.yml`, or in the Prometheus Operator.
295297

296298
For more information on configuring remote-write, see the Prometheus.io article: [Configuration](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write). For more on tuning the remote write configuration, see [Remote write tuning](https://prometheus.io/docs/practices/remote_write/#remote-write-tuning).
297299

298-
To send data to your Azure Monitor Workspace, add the following section to the configuration file of your self-managed Prometheus instance.
300+
### [Configure remote-write for Prometheus Operator](#tab/prom-operator)
301+
302+
If you are running Prometheus Operator on a Kubernetes cluster, follow the below steps to send data to your Azure Monitor Workspace.
303+
304+
1. If you are using Microsoft Entra ID authentication, convert the secret using base64 encoding, and then apply the secret into your Kubernetes cluster. Save the following into a yaml file. Skip this step if you are using managed identity authentication.
305+
306+
```yaml
307+
apiVersion: v1
308+
kind: Secret
309+
metadata:
310+
name: remote-write-secret
311+
namespace: monitoring # Replace with namespace where Prometheus Operator is deployed.
312+
type: Opaque
313+
data:
314+
password: <base64-encoded-secret>
315+
316+
```
317+
318+
Apply the secret.
319+
320+
```azurecli
321+
# set context to your cluster
322+
az aks get-credentials -g <aks-rg-name> -n <aks-cluster-name>
323+
324+
kubectl apply -f <remote-write-secret.yaml>
325+
```
326+
327+
1. You will need to update the values for remote write section in Prometheus Operator. Copy the following and save it as a yaml file. For the values of the yaml file, see below section. Refer to [Prometheus Operator documentation](https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#azuread) for more details on the Azure Monitor Workspace remote write specification in Prometheus Operator.
328+
329+
```yaml
330+
prometheus:
331+
prometheusSpec:
332+
remoteWrite:
333+
- url: "<metrics ingestion endpoint for your Azure Monitor workspace>"
334+
azureAd:
335+
# AzureAD configuration.
336+
# The Azure Cloud. Options are 'AzurePublic', 'AzureChina', or 'AzureGovernment'.
337+
cloud: 'AzurePublic'
338+
managedIdentity:
339+
clientId: "<clientId of the managed identity>"
340+
oauth:
341+
clientId: "<clientId of the Entra app>"
342+
clientSecret:
343+
name: remote-write-secret
344+
key: password
345+
tenantId: "<Azure subscription tenant Id>"
346+
```
347+
348+
1. Use helm to update your remote write config using the above yaml file.
349+
350+
```azurecli
351+
helm upgrade -f <YAML-FILENAME>.yml prometheus prometheus-community/kube-prometheus-stack --namespace <namespace where Prometheus Operator is deployed>
352+
```
353+
354+
### [Configure remote-write for Prometheus running in VMs or other environments](#tab/prom-vm)
355+
356+
To send data to your Azure Monitor Workspace, add the following section to the configuration file (prometheus.yml) of your self-managed Prometheus instance.
299357

300358
```yaml
301359
remote_write:
@@ -312,6 +370,8 @@ remote_write:
312370
tenant_id: "<Azure subscription tenant Id>"
313371
```
314372
373+
---
374+
315375
The `url` parameter specifies the metrics ingestion endpoint of the Azure Monitor workspace. It can be found on the Overview page of your Azure Monitor workspace in the Azure portal.
316376

317377
:::image type="content" source="media/prometheus-remote-write-virtual-machines/metrics-ingestion-endpoint.png" lightbox="media/prometheus-remote-write-virtual-machines/metrics-ingestion-endpoint.png" alt-text="A screenshot showing the metrics ingestion endpoint for an Azure Monitor workspace.":::

0 commit comments

Comments
 (0)