Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
docs
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
docs
Commits
46d396e6
Commit
46d396e6
authored
May 13, 2016
by
Patrick Bogen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add example of kubernetes service discovery config
parent
3602d49d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
+51
-0
configuration.md
content/docs/operating/configuration.md
+51
-0
No files found.
content/docs/operating/configuration.md
View file @
46d396e6
...
...
@@ -406,6 +406,57 @@ tls_config:
[ retry_interval: <duration> | default = 1s ]
```
#### Example `<kubernetes_sd_config>`
The example below scrapes a number of resources:
*
Any pods that have the annotation
`prometheus.io/scrape`
set to the string
`true`
. If the pods also have an annotation
`prometheus.io/port`
, then the
target port on which to scrape is changed from the default
`9102`
to the value
of that annotation.
*
All Kubernetes Nodes
Additionally, for all such resources, some labels are retained from the data
reported by Kubernetes:
*
Any actual Kubernetes label is preserved in a Prometheus label.
*
The Kubernetes "namespace" of pods is preserved in the Prometheus label
`kubernetes_namespace`
.
*
The Kubernetes pod name is preserved in the Prometheus label
`kubernetes_pod_name`
.
`prometheus.yml`
:
```
---
# documented: http://prometheus.io/docs/operating/configuration/
rule_files:
-
/alert.rules
scrape_configs:
-
job_name: scrape_annotated_pods
kubernetes_sd_configs:
-
api_servers:
-
https://kubernetes
in_cluster: true
relabel_configs:
-
source_labels:
[
__meta_kubernetes_pod_annotation_prometheus_io_scrape
]
regex: true
action: keep
-
source_labels:
[
__address__, __meta_kubernetes_pod_annotation_prometheus_io_port
]
regex: (.
*):(?:.*
);(.+)
action: replace
target_label: __address__
replacement: ${1}:${2}
-
source_labels:
[
__meta_kubernetes_role
]
regex: node
action: keep
-
action: labelmap
regex: __meta_kubernetes_pod_label_(.+)
-
source_labels:
[
__meta_kubernetes_pod_namespace
]
action: replace
target_label: kubernetes_namespace
-
source_labels:
[
__meta_kubernetes_pod_name
]
action: replace
target_label: kubernetes_pod_name
```
### `<marathon_sd_config>`
CAUTION: Marathon SD is in beta: breaking changes to configuration are still
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment