mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-02-09 15:27:11 +00:00
Docs: Operator Additional Scrape Configuration - update docs (#2826)
Signed-off-by: Artem Navoiev <tenmozes@gmail.com>
This commit is contained in:
parent
3960fecac2
commit
9c763490b7
1 changed files with 16 additions and 19 deletions
|
@ -4,21 +4,18 @@ sort: 2
|
||||||
|
|
||||||
# Additional Scrape Configuration
|
# Additional Scrape Configuration
|
||||||
|
|
||||||
AdditionalScrapeConfigs allows specifying a key of a Secret containing
|
AdditionalScrapeConfigs is an additional way to add scrape targets in VMAgent CRD.
|
||||||
additional Prometheus scrape configurations or define scrape configuration at CRD spec.
|
There are two options for adding targets into VMAgent: inline configuration into CRD or defining it as a Kubernetes Secret.
|
||||||
Scrape configurations specified
|
|
||||||
are appended to the configurations generated by the operator.
|
|
||||||
|
|
||||||
Job configurations specified must have the form as specified in the official
|
No validation happens during the creation of configuration. However, you must validate job specs, and it must follow job spec configuration.
|
||||||
[Prometheus documentation](
|
Please check official Prometheus documentation as references.
|
||||||
https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config).
|
[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.
|
|
||||||
|
|
||||||
## 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
|
```yaml
|
||||||
cat <<EOF | kubectl apply -f -
|
cat <<EOF | kubectl apply -f -
|
||||||
apiVersion: operator.victoriametrics.com/v1beta1
|
apiVersion: operator.victoriametrics.com/v1beta1
|
||||||
|
@ -38,14 +35,14 @@ spec:
|
||||||
EOF
|
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.
|
You need to define Kubernetes Secret with a key.
|
||||||
Below we are making a simple "prometheus" config. Name this
|
|
||||||
`prometheus-additional.yaml` or something similar.
|
The key is `prometheus-additional.yaml` in the example below
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
cat <<EOF | kubectl apply -f -
|
cat <<EOF | kubectl apply -f -
|
||||||
|
@ -61,7 +58,7 @@ stringData:
|
||||||
EOF
|
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
|
```yaml
|
||||||
cat <<EOF | kubectl apply -f -
|
cat <<EOF | kubectl apply -f -
|
||||||
|
@ -81,5 +78,5 @@ spec:
|
||||||
EOF
|
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.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue