From 47118f27b17fb275eddf2725a4a373939fbce2a1 Mon Sep 17 00:00:00 2001 From: Florian Bacher Date: Fri, 11 Oct 2024 10:36:54 +0200 Subject: [PATCH] [chore] add documentation for setting up RBAC for the k8sobserver extension (#35597) #### Description This PR extends the readme of the k8sobserver by describing how to set up the required RBAC permissions to observe the related k8s resources #### Link to tracking issue Fixes #35595 #### Documentation Extended the readme Signed-off-by: Florian Bacher --- extension/observer/k8sobserver/README.md | 167 ++++++++++++++++++++++- 1 file changed, 166 insertions(+), 1 deletion(-) diff --git a/extension/observer/k8sobserver/README.md b/extension/observer/k8sobserver/README.md index 6929cbd799ce..9b3856b042f3 100644 --- a/extension/observer/k8sobserver/README.md +++ b/extension/observer/k8sobserver/README.md @@ -75,4 +75,169 @@ All fields are optional. | observe_ingresses | bool | `false` | Whether to report observer k8s.ingress endpoints.| More complete configuration examples on how to use this observer along with the `receiver_creator`, -can be found at the [Receiver Creator](../../../receiver/receivercreator/README.md)'s documentation. \ No newline at end of file +can be found at the [Receiver Creator](../../../receiver/receivercreator/README.md)'s documentation. + +### Setting up RBAC permissions + +When using the `serviceAccount` `auth_type`, the service account of the pod running the agent needs to have the required permissions to +read the K8s resources it should observe (i.e. pods, nodes, services and ingresses). +Therefore, the service account running the pod needs to have the required `ClusterRole` which grants it the permission to +read those resources from the Kubernetes API. Below is an example of how to set this up: + +1. Create a `ServiceAccount` that the collector should use. + +```bash +< + + service: + pipelines: + metrics: + receivers: [receiver_creator] + exporters: [otlp] +EOF +``` + +4. Create the collector deployment, referring to the service account created earlier + +```bash +<