This pattern can be used when deploying the OpenTelemetry Collector on Kubernetes. It comes with the following variants:
-
Agent as sidecar, where a container is added to the workload pod with the OpenTelemetry Collector. This instance is then configured to send data to an external collector, potentially in a different namespace or cluster.
-
Agent as DaemonSet, where a DaemonSet is used instead, so that we have one agent pod per Kubernetes node. Note that this is not recommended for multitenant deployments, as the agent will receive data from all of the pods in the node, irrespective of namespace.
The blog post "Deploying the OpenTelemetry Collector on Kubernetes" shows in details how to achieve both scenarios. The OpenTelemetry Operator can also be used for that, including the ability to inject sidecars into the workload pods automatically.