Skip to content

Commit

Permalink
docs(prometheus/scrape): add example for K8s auth (#829) (#844)
Browse files Browse the repository at this point in the history
* docs(prometheus/scrape): add example for K8s auth

Signed-off-by: hainenber <dotronghai96@gmail.com>

* Apply suggestions from Clayton's code review

Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com>

* Apply suggestions from 2nd Clayton's code review

Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com>

---------

Signed-off-by: hainenber <dotronghai96@gmail.com>
Co-authored-by: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com>
(cherry picked from commit d8831a5)

Co-authored-by: Đỗ Trọng Hải <41283691+hainenber@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and hainenber committed May 14, 2024
1 parent 0b3cb82 commit 9c5f942
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/sources/reference/components/prometheus.scrape.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ present.

## Example

### Set up scrape jobs for `blackbox exporter` targets

The following example sets up the scrape job with certain attributes (scrape
endpoint, scrape interval, query parameters) and lets it scrape two instances
of the [blackbox exporter](https://github.com/prometheus/blackbox_exporter/).
Expand Down Expand Up @@ -286,6 +288,22 @@ http://blackbox-exporter:9115/probe?target=grafana.com&module=http_2xx
http://blackbox-exporter:9116/probe?target=grafana.com&module=http_2xx
```

### Authentication with the Kubernetes API server

The following example shows you how to authenticate with the Kubernetes API server.

```alloy
prometheus.scrape "kubelet" {
scheme = "https"
tls_config {
server_name = "kubernetes"
ca_file = "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
insecure_skip_verify = false
}
bearer_token_file = "/var/run/secrets/kubernetes.io/serviceaccount/token"
}
```

### Technical details

`prometheus.scrape` supports [gzip](https://en.wikipedia.org/wiki/Gzip) compression.
Expand Down

0 comments on commit 9c5f942

Please sign in to comment.