Skip to content

Commit

Permalink
Docs/correct discover kubernetes constants example (#5900)
Browse files Browse the repository at this point in the history
* Update example limiting pods on the same node

* Update example syntax

* Add note about helm chart

* Minor syntax tidy
  • Loading branch information
clayton-cornell authored Nov 30, 2023
1 parent dc63de2 commit 0ecc190
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions docs/sources/flow/reference/components/discovery.kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -462,14 +462,20 @@ Replace the following:

### Limit to only pods on the same node

This example limits the search to pods on the same node as this {{< param "PRODUCT_ROOT_NAME" >}}. This configuration could be useful if you are running {{< param "PRODUCT_ROOT_NAME" >}} as a DaemonSet:
This example limits the search to pods on the same node as this {{< param "PRODUCT_ROOT_NAME" >}}.
This configuration could be useful if you are running {{< param "PRODUCT_ROOT_NAME" >}} as a DaemonSet.

{{% admonition type="note" %}}
This example assumes you have used Helm chart to deploy {{< param "PRODUCT_NAME" >}} in Kubernetes and sets `HOSTNAME` to the Kubernetes host name.
If you have a custom Kubernetes deployment, you must adapt this example to your configuration.
{{% /admonition %}}

```river
discovery.kubernetes "k8s_pods" {
role = "pod"
selectors {
role = "pod"
field = "spec.nodeName=" + constants.hostname
field = "spec.nodeName=" + coalesce(env("HOSTNAME"), constants.hostname)
}
}
Expand All @@ -489,6 +495,7 @@ prometheus.remote_write "demo" {
}
}
```

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.
Expand Down

0 comments on commit 0ecc190

Please sign in to comment.