From 0ecc1900afe4b87a5036ec1fe973ed4bb22e605a Mon Sep 17 00:00:00 2001 From: Clayton Cornell <131809008+clayton-cornell@users.noreply.github.com> Date: Thu, 30 Nov 2023 10:25:36 -0800 Subject: [PATCH] Docs/correct discover kubernetes constants example (#5900) * Update example limiting pods on the same node * Update example syntax * Add note about helm chart * Minor syntax tidy --- .../flow/reference/components/discovery.kubernetes.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/sources/flow/reference/components/discovery.kubernetes.md b/docs/sources/flow/reference/components/discovery.kubernetes.md index 3dac34c7c711..94b8ee84d945 100644 --- a/docs/sources/flow/reference/components/discovery.kubernetes.md +++ b/docs/sources/flow/reference/components/discovery.kubernetes.md @@ -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) } } @@ -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.