Skip to content

Commit

Permalink
discovery.kubernetes docs: add example for node filtering (#5326)
Browse files Browse the repository at this point in the history
Co-authored-by: Paschalis Tsilias <[email protected]>
Co-authored-by: Clayton Cornell <[email protected]>
  • Loading branch information
3 people authored Oct 5, 2023
1 parent 4d73924 commit 986770e
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions docs/sources/flow/reference/components/discovery.kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -458,3 +458,37 @@ Replace the following:
- `PROMETHEUS_REMOTE_WRITE_URL`: The URL of the Prometheus remote_write-compatible server to send metrics to.
- `USERNAME`: The username to use for authentication to the remote_write API.
- `PASSWORD`: The password to use for authentication to the remote_write API.

### Limit to only pods on the same node

This example limits the search to pods on the same node as this Grafana Agent. This configuration could be useful if you are running the Agent as a DaemonSet:

```river
discovery.kubernetes "k8s_pods" {
role = "pod"
selectors {
role = "pod"
field = "spec.nodeName=" + constants.hostname
}
}
prometheus.scrape "demo" {
targets = discovery.kubernetes.k8s_pods.targets
forward_to = [prometheus.remote_write.demo.receiver]
}
prometheus.remote_write "demo" {
endpoint {
url = PROMETHEUS_REMOTE_WRITE_URL
basic_auth {
username = USERNAME
password = PASSWORD
}
}
}
```
Replace the following:
- `PROMETHEUS_REMOTE_WRITE_URL`: The URL of the Prometheus remote_write-compatible server to send metrics to.
- `USERNAME`: The username to use for authentication to the remote_write API.
- `PASSWORD`: The password to use for authentication to the remote_write API.

0 comments on commit 986770e

Please sign in to comment.