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
+22-39Lines changed: 22 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -467,10 +467,10 @@ If you are using `basic_auth` setting in your prometheus configuration, please f
467
467
468
468
Below is an example of creating a secret.
469
469
470
-
1. Create a secret object in the **kube-system** namespace named **ama-metrics-mtls-secret**.
470
+
1. Create a secret object in the **kube-system** namespace named **ama-metrics-mtls-secret**. Inside the secret object , you can specify as many number of secret values under data section and name them how ever you want.
471
+
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.
472
+
The secret values should be base64 encoded before putting them under the data section.
471
473
472
-
473
-
The value for password1 is **base64encoded**
474
474
The key *password1* can be anything, but just needs to match your scrapeconfig *password_file* filepath.
475
475
476
476
```yaml
@@ -497,53 +497,42 @@ basic_auth:
497
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.
498
498
Please follow the below steps.
499
499
500
-
1. Create a secret object in the **kube-system** namespace named **ama-metrics-mtls-secret**. Example command for creating secret below:
1. Create a secret object using the TLS certificate in the **kube-system** namespace named **ama-metrics-mtls-secret**.
501
+
Below is an example command for creating a secret using the TLS self-signed certificate, in case of CRD based scraping. Please make sure that the secret object is created using the file naming format exactly as in the example below, in case of a CRD based scraping.
The key *password1* can be anything, but just needs to match with the keys/filenames mentioned in your CRD/Configmap.
507
-
508
-
```yaml
509
-
apiVersion: v1
510
-
kind: Secret
511
-
metadata:
512
-
name: ama-metrics-mtls-secret
513
-
namespace: kube-system
514
-
type: Opaque
515
-
data:
516
-
password1: <base64-encoded-string>
517
-
```
518
-
519
-
2. Below are the details about how to provide the TLS config settings through a configmap or CRD.
510
+
2. Below are the details about how to provide the TLS config settings through a configmap or CRD.
520
511
521
-
- To provide the TLS config setting in a configmap, please create the self-signed certificate and key inside your mtls enabled app.
522
-
An example tlsConfig inside the config map should look like this:
512
+
- To provide the TLS config setting in a configmap, please follow the below example.
523
513
524
514
```yaml
525
515
tls_config:
526
-
ca_file: /etc/prometheus/certs/client-cert.pem
527
-
cert_file: /etc/prometheus/certs/client-cert.pem
528
-
key_file: /etc/prometheus/certs/client-key.pem
516
+
ca_file: /etc/prometheus/certs/<certfile> # since it is self-signed
517
+
cert_file: /etc/prometheus/certs/<certfile>
518
+
key_file: /etc/prometheus/certs/<keyfile>
529
519
insecure_skip_verify: false
530
520
```
531
521
532
-
- To provide the TLS config setting in a CRD, please create the self-signed certificate and key inside your mtls enabled app.
533
-
An example tlsConfig inside a Podmonitor should look like this:
522
+
- To provide the TLS config setting in a configmap, please follow the below example.
534
523
535
524
```yaml
536
525
tlsConfig:
537
526
ca:
538
527
secret:
539
-
key: "client-cert.pem" # since it is self-signed
528
+
key: "<certfile>" # since it is self-signed
540
529
name: "ama-metrics-mtls-secret"
541
530
cert:
542
531
secret:
543
-
key: "client-cert.pem"
532
+
key: "<certfile>"
544
533
name: "ama-metrics-mtls-secret"
545
534
keySecret:
546
-
key: "client-key.pem"
535
+
key: "<keyfile>"
547
536
name: "ama-metrics-mtls-secret"
548
537
insecureSkipVerify: false
549
538
```
@@ -556,15 +545,9 @@ tlsConfig:
556
545
>
557
546
> The base64 encoded value is automatically decoded by the agent pods when the secret is mounted as file.
558
547
>
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.
564
-
>
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.
548
+
> Make sure the secret name is **ama-metrics-mtls-secret** and it is in **kube-system** namespace.
566
549
>
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....`
550
+
> The secret should be created 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....`
568
551
>
569
552
> To read more on TLS configuration settings, please follow this [Configurations](https://aka.ms/tlsconfigsetting).
0 commit comments