forked from prometheus-operator/prometheus-operator
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into HEAD
- Loading branch information
Showing
1,101 changed files
with
110,095 additions
and
21,830 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Additional Scrape Configuration | ||
|
||
AdditionalScrapeConfigs allows specifying a key of a Secret containing | ||
additional Prometheus scrape configurations. Scrape configurations specified | ||
are appended to the configurations generated by the Prometheus Operator. | ||
|
||
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. *Note* that using this feature may expose the possibility to break | ||
upgrades of Prometheus. | ||
|
||
It is advised to review Prometheus release notes to ensure that no incompatible | ||
scrape configs are going to break Prometheus after the upgrade. | ||
|
||
## Creating an additional configuration | ||
|
||
First, you will need to create the additional configuration. | ||
Below we are making a simple "prometheus" config. Name this | ||
`prometheus-additional.yaml` or something similiar. | ||
|
||
``` | ||
- job_name: "prometheus" | ||
static_configs: | ||
- targets: ["localhost:9090"] | ||
``` | ||
|
||
Then you will need to make a secret out of this configuration. | ||
|
||
``` | ||
kubectl create secret generic additional-scrape-configs --from-file=prometheus-additional.yaml --dry-run -oyaml > additional-scrape-configs.yaml | ||
``` | ||
|
||
Next, create a new secret using the base64 encoded output as the value for | ||
`prometheus-additional.yaml` in the secret. | ||
|
||
``` | ||
apiVersion: v1 | ||
data: | ||
prometheus-additional.yaml: LSBqb2JfbmFtZTogInByb21ldGhldXMiCiAgc3RhdGljX2NvbmZpZ3M6CiAgLSB0YXJnZXRzOiBbImxvY2FsaG9zdDo5MDkwIl0K | ||
kind: Secret | ||
metadata: | ||
creationTimestamp: null | ||
name: additional-scrape-configs | ||
``` | ||
|
||
Finally, reference this additional configuration in your `prometheus.yaml` CRD. | ||
|
||
``` | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: Prometheus | ||
metadata: | ||
name: prometheus | ||
labels: | ||
prometheus: prometheus | ||
spec: | ||
replicas: 2 | ||
serviceAccountName: prometheus | ||
serviceMonitorSelector: | ||
matchLabels: | ||
team: frontend | ||
additionalScrapeConfigs: | ||
name: additional-scrape-configs | ||
key: prometheus-additional.yaml | ||
... | ||
``` | ||
|
||
NOTE: Use only one secret for ALL additional scrape configurations. | ||
|
||
## Additional References | ||
|
||
* [Prometheus Spec](https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec) | ||
* [Additional Scrape Configs](https://github.com/coreos/prometheus-operator/tree/master/example/additional-scrape-configs) |
Oops, something went wrong.