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/prometheus-metrics-scrape-configuration.md
+17-26Lines changed: 17 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -483,12 +483,6 @@ type: Opaque
483
483
data:
484
484
password1: <base64-encoded-string>
485
485
```
486
-
> [!NOTE]
487
-
>
488
-
> Make sure the name is **ama-metrics-mtls-secret** and it is in **kube-system** namespace.
489
-
>
490
-
> Inside the secret object , you can specify as many number of secret values under data section and name them how ever you want. Each secret name-value pair specified in the data section of the secret object will be mounted as a seperate file in this /etc/prometheus/certs location with filename(s) same as key(s) specified in the data section. The secret values should be base64 encoded before putting them under the data section.
491
-
492
486
493
487
2. In the configmap for the custom scrape configuration use the following setting -
494
488
```yaml
@@ -498,25 +492,15 @@ basic_auth:
498
492
499
493
```
500
494
501
-
> [!NOTE]
502
-
>
503
-
> Pod and Service monitors currently do not support basic authentication. Support for the same is coming up soon.
504
-
>
505
-
> The **/etc/prometheus/certs/** path is mandatory, but *password1* can be any string and needs to match the key for the data in the secret created above. This is because the secret **ama-metrics-mtls-secret** is mounted in the path **/etc/prometheus/certs/** within the container.
506
-
>
507
-
> The base64 encoded value is automatically decoded by the agent pods when the secret is mounted as file.
508
-
>
509
-
> Any other configuration setting for authorization that is considered as a secret in the [prometheus configuration](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config) needs to use the file setting alternative instead as described above.
510
-
511
-
512
495
### TLS based scraping
513
496
514
497
If you have a Prometheus instance served with TLS and you want to scrape metrics from it, you need to set scheme to `https` and set the TLS settings in your configmap or respective CRD.
515
498
Please follow the below steps.
516
499
517
-
1. Create a secret object in the **kube-system** namespace named **ama-metrics-mtls-secret**.
518
-
Example command for creating secret: kubectl create secret generic ama-metrics-mtls-secret --from-file=secret_kube-system_ama-metrics-mtls-secret_client-cert.pem=secret_kube-system_ama-metrics-mtls-secret_client-cert.pem --from-file=secret_kube-system_ama-metrics-mtls-secret_client-key.pem=secret_kube-system_ama-metrics-mtls-secret_client-key.pem -n kube-system.
519
-
500
+
1. Create a secret object in the **kube-system** namespace named **ama-metrics-mtls-secret**. Example command for creating secret below:
The key *password1* can be anything, but just needs to match with the keys/filenames mentioned in your CRD/Configmap.
@@ -531,11 +515,6 @@ type: Opaque
531
515
data:
532
516
password1: <base64-encoded-string>
533
517
```
534
-
> [!NOTE]
535
-
>
536
-
> Make sure the name is **ama-metrics-mtls-secret** and it is in **kube-system** namespace.
537
-
>
538
-
> Inside the secret object , you can specify as many number of secret values under data section and name them how ever you want. Each secret name-value pair specified in the data section of the secret object will be mounted as a seperate file in this /etc/prometheus/certs location with filename(s) same as key(s) specified in the data section. The secret values should be base64 encoded before putting them under the data section.
539
518
540
519
2. Below are the details about how to provide the TLS config settings through a configmap or CRD.
541
520
@@ -570,8 +549,20 @@ tlsConfig:
570
549
```
571
550
572
551
> [!NOTE]
552
+
>
553
+
> Pod and Service monitors currently do not support basic authentication. Support for the same is coming up soon.
554
+
>
555
+
> The **/etc/prometheus/certs/** path is mandatory, but *password1* can be any string and needs to match the key for the data in the secret created above. This is because the secret **ama-metrics-mtls-secret** is mounted in the path **/etc/prometheus/certs/** within the container.
556
+
>
557
+
> The base64 encoded value is automatically decoded by the agent pods when the secret is mounted as file.
558
+
>
559
+
> Any other configuration setting for authorization that is considered as a secret in the [prometheus configuration](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config) needs to use the file setting alternative instead as described above.
560
+
>
561
+
> Make sure the name is **ama-metrics-mtls-secret** and it is in **kube-system** namespace.
562
+
>
563
+
> Inside the secret object , you can specify as many number of secret values under data section and name them how ever you want. Each secret name-value pair specified in the data section of the secret object will be mounted as a seperate file in this /etc/prometheus/certs location with filename(s) same as key(s) specified in the data section. The secret values should be base64 encoded before putting them under the data section.
573
564
>
574
-
> Make sure that the certificate file name and key name inside the mtls app is in the following format in case of a CRD based scraping. For example: secret_kube-system_ama-metrics-mtls-secret_cert-name.pem and secret_kube-system_ama-metrics-mtls-secret_key-name.pem.
565
+
> Please make sure that the mounted secret object is created using the command above and the file naming is followed as-is, in case of a CRD based scraping.
575
566
>
576
567
> The secret should be created in kube-system namespace and then the configmap/CRD should be created in kube-system namespace. The order of secret creation matters. When there's no secret but a valid CRD/config map, you will find errors in collector log -> `no file found for cert....`
0 commit comments