Docs: Operator Additional Scrape Configuration - update docs (#2826)

Signed-off-by: Artem Navoiev <tenmozes@gmail.com>
This commit is contained in:
Artem Navoiev 2022-07-05 12:06:23 +03:00 committed by GitHub
parent 3960fecac2
commit 9c763490b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,21 +4,18 @@ sort: 2
# Additional Scrape Configuration
AdditionalScrapeConfigs allows specifying a key of a Secret containing
additional Prometheus scrape configurations or define scrape configuration at CRD spec.
Scrape configurations specified
are appended to the configurations generated by the operator.
AdditionalScrapeConfigs is an additional way to add scrape targets in VMAgent CRD.
There are two options for adding targets into VMAgent: inline configuration into CRD or defining it as a Kubernetes Secret.
Job configurations specified must have the form as specified in the official
[Prometheus documentation](
https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config).
As scrape configs are appended, the user is responsible to make sure it is
valid.
No validation happens during the creation of configuration. However, you must validate job specs, and it must follow job spec configuration.
Please check official Prometheus documentation as references.
[Prometheus documentation](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config).
## Creating an additional configuration inline at CRD
## Inline Additional Scrape Configuration in VMAgent CRD
You need to add scrape configuration directly to the vmagent spec.inlineScrapeConfig. It is raw text in YAML format.
See example below
Add needed scrape configuration directly to the vmagent spec.inlineScrapeConfig
```yaml
cat <<EOF | kubectl apply -f -
apiVersion: operator.victoriametrics.com/v1beta1
@ -38,14 +35,14 @@ spec:
EOF
```
NOTE: Do not use password and tokens with inlineScrapeConfig.
**Note**: Do not use passwords and tokens with inlineScrapeConfig use Secret instead of
## Creating an additional configuration with secret
## Define Additional Scrape Configuration as a Kubernetes Secret
First, you will need to create the additional configuration.
Below we are making a simple "prometheus" config. Name this
`prometheus-additional.yaml` or something similar.
You need to define Kubernetes Secret with a key.
The key is `prometheus-additional.yaml` in the example below
```yaml
cat <<EOF | kubectl apply -f -
@ -61,7 +58,7 @@ stringData:
EOF
```
Finally, reference this additional configuration in your `vmagent.yaml` CRD.
After that, you need to specify the secret's name and key in VMAgent CRD in `additionalScrapeConfigs` section
```yaml
cat <<EOF | kubectl apply -f -
@ -81,5 +78,5 @@ spec:
EOF
```
NOTE: Use only one secret for ALL additional scrape configurations.
**Note**: You can specify only one Secret in the VMAgent CRD configuration so use it for all additional scrape configurations.