Skip to content

Commit 3bfeb16

Browse files
make single note and update note
1 parent dae5586 commit 3bfeb16

File tree

1 file changed

+17
-26
lines changed

1 file changed

+17
-26
lines changed

articles/azure-monitor/containers/prometheus-metrics-scrape-configuration.md

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -483,12 +483,6 @@ type: Opaque
483483
data:
484484
password1: <base64-encoded-string>
485485
```
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-
492486

493487
2. In the configmap for the custom scrape configuration use the following setting -
494488
```yaml
@@ -498,25 +492,15 @@ basic_auth:
498492
499493
```
500494

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-
512495
### TLS based scraping
513496

514497
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.
515498
Please follow the below steps.
516499

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:
501+
```console
502+
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
503+
```
520504

521505
The value for password1 is **base64encoded**
522506
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
531515
data:
532516
password1: <base64-encoded-string>
533517
```
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.
539518

540519
2. Below are the details about how to provide the TLS config settings through a configmap or CRD.
541520

@@ -570,8 +549,20 @@ tlsConfig:
570549
```
571550

572551
> [!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.
573564
>
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.
575566
>
576567
> 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....`
577568
>

0 commit comments

Comments
 (0)