OpenTelemetry Collector agent vs gateway deployment: which fits your platform
If you are standardizing telemetry, you need to decide where Collectors run. An agent sits next to workloads, typically as a sidecar or a per-node process, while a gateway is a central Collector that accepts data from many sources. Most mature setups use both: agents collect and lightly enrich data close to the source, and gateways handle the work that needs a central view, such as shared credentials, routing and export to back ends. The Collector is a vendor-agnostic way to receive, process and export telemetry, and its repository is licensed under Apache-2.0. It is not an observability backend, so you still need a separate system to store and visualize traces, metrics and logs.
Run an agent when the data has to be captured where it is produced. Host-level collection (CPU, memory, disk and log files on a VM or node) and anything that depends on local files or sockets generally belongs in an agent. Agents also keep a single noisy workload from filling a shared queue, and they let each node keep buffering data while a central tier is unreachable. Add a gateway when several services or clusters should send through one controlled exit point, when credentials for the back end should live in one place rather than on every node, or when you need processing that depends on seeing a whole trace or stream, such as tail sampling. The Collector's configuration, which you should store securely and keep limited to the components you use, is the same file pattern in both roles, so the choice is mostly about placement, not different software.
Before you commit, confirm which Collector distribution and version your teams will standardize on, since the components available in each role depend on the build. Ask who owns the agent fleet and who owns the gateway, how credentials will reach each tier (the authenticator extensions can check incoming connections and add credentials to outgoing requests), and how a gateway outage will affect agents. Then decide the failure domain you can accept, for example one gateway per region versus one per cluster. Those answers drive the cost of the design: more tiers mean more Collector instances to run, patch and monitor, while a single gateway concentrates risk. Document the decision so it can be revisited when volumes or back ends change.
How agent and gateway Collectors connect to workloads and back ends
The flow starts with applications exporting OTLP to a Collector agent on each node, which runs next to the workloads inside the node trust boundary. Agents forward to a gateway Collector in the cluster or region, and that hand-off is where the credentials for the gateway are attached through an authenticator extension. The gateway is where enrichment and redaction are usually applied before it exports to one or more back ends. Check which side of the boundary holds each secret, and whether the gateway can be reached only from the agents.
Agents sit beside workloads and forward through one gateway to the back ends.
Three deployment patterns and what each one does
The Collector can run as an agent beside each workload or as a gateway that accepts data from many sources, and most teams combine the two. The cards below compare placement, data path and the main reason to choose each pattern, plus the Kubernetes and virtual machine differences that change the design.
Agent only
Collectors run next to each service or on each host, and every agent exports straight to the back end. Each agent holds its own export credentials and its own retry queue, so a failed agent affects only its own workload. The trade-off is that enrichment, sampling and credential rotation must be repeated on every agent. Check how many agents will need a configuration change when the back end endpoint or key changes.
Collector docsGateway only
Applications send telemetry to one central Collector per cluster or region, which processes it and exports to the back end. Credentials, redaction rules and routing live in one place, which simplifies review for security and compliance teams. The main risk is a shared failure point: if the gateway is overloaded or down, data from every source is affected. Confirm the sizing, scaling and queue behavior before the gateway becomes the only path.
Collector docsAgent plus gateway
Agents collect and do light work close to the workload, then forward to a gateway that handles authentication, batching and export. This splits responsibilities: agents own host and container collection, and the gateway owns credentials and back-end connectivity. Teams should expect two tiers to configure, monitor and upgrade, and should decide early which tier owns redaction and sampling so data is not processed twice or not at all.
Kubernetes placement
In Kubernetes, the agent is usually a DaemonSet so that one Collector runs on every node, while the gateway is a Deployment behind a Service. Agents can read node and pod context that a central gateway cannot see, which is why node-level collection is typically placed there. Confirm how your distribution, namespaces and network policies allow agents to reach the gateway before you finalize the layout.
Virtual machines and bare metal
On VMs and servers, the agent runs as a system service on each host, and host metrics and log files are read from the local operating system. A regional gateway on dedicated hosts or VMs then receives data over the network, which keeps credentials off the application hosts. Check how the Collector service is installed, how it is upgraded across fleets, and whether network paths to the gateway stay inside controlled networks.
Choosing agent, gateway or both by requirement
This table compares agent, gateway and combined Collector placement across failure isolation, metadata enrichment, credential placement, network paths and operating cost. Read each row against your own failure domains and compliance boundaries, then use the combined pattern when a single tier cannot meet both collection and central processing needs.
| Requirement | Agent only | Gateway only | Agent plus gateway |
|---|---|---|---|
| Failure isolation | A crashed or misconfigured agent affects only the workloads on that host or node | One gateway outage can stop telemetry from every source it serves until capacity recovers | Node-level faults stay local, and gateway faults can be absorbed by buffering in the agent tier |
| Resource metadata enrichment | Can attach host, pod and container attributes close to the source, using the Collector's resource detection | Sees only what senders include, so enrichment depends on each source or on lookups the gateway can reach | Agents add source metadata and the gateway applies central, shared enrichment |
| Credential placement | Back-end credentials must be distributed to every node, widening the set of hosts that hold them | Back-end credentials stay in a small, controlled set of gateway hosts | Node hosts hold only ingest credentials for the gateway, and back-end secrets stay central |
| Network paths | Every node opens paths to the back end or gateway, which can be hard to firewall in segmented networks | Sources reach one ingress point, simplifying firewall rules but concentrating east-west and egress traffic | Node traffic stays on the cluster network, and only the gateway tier crosses into the back-end network |
| Stateful processing such as tail sampling | Not suitable, because a trace's spans may land on different agents | Possible, but the gateway must route all spans of a trace to the same instance | Requires a load-balancing tier in front of the stateful gateway pool, which adds components to run |
| Operating cost | Costs grow with node count, including configuration rollouts, upgrades and per-node resource use | Fewer deployments to upgrade, but sizing, scaling and high availability work concentrate in one pool | Highest component count, so the trade-off is more upgrades and dashboards against clearer ownership |
| Confirm before choosing | Check the resource footprint on your busiest nodes and the components your distribution includes | Check queue and memory sizing, back-end throughput limits and how your team scales the pool | Confirm ownership of each tier, the upgrade order and which team holds the back-end credentials |
How failure isolation changes with placement
An agent failure is contained to the host or pod it runs on, while a gateway failure reaches every workload that sends data through it. When an agent Collector crashes or stalls, the telemetry from that one node stops or backs up, and the application workloads on other nodes keep exporting normally. When a gateway in a shared pool fails, every agent or SDK that points at it loses its export path at the same time, so the blast radius is the whole cluster or region. This is the main reason to keep the gateway tier small in function and to run it with more than one replica behind a stable endpoint. Confirm how your Kubernetes Service or load balancer handles a gateway pod that is restarting, because a stale endpoint can extend an outage well beyond the pod itself.
Queues and retries sit in different places in each tier, and that determines where data is lost during an outage. An agent typically holds a short in-memory queue for its exporter, so a back-end outage that lasts longer than that buffer will drop data at the edge unless the agent also has a persistent queue. A gateway holds a larger queue for many senders, which absorbs more traffic but also concentrates memory pressure in one process. Retries multiply this effect: if every agent retries against a recovering gateway at once, the gateway can fall over again. Review the sending queue and retry settings of each tier together, and check the Collector's own telemetry for refused or dropped data, rather than assuming the two queues protect each other.
Restart and memory pressure risks follow the same pattern and deserve planning before go-live. A Collector that hits its memory limit may refuse incoming data or be restarted by the orchestrator, and a gateway restart interrupts more senders than an agent restart does. Stateful processing, such as tail sampling, makes a gateway restart lose in-flight traces that were waiting for their spans to arrive. For sizing thresholds, queue capacity and batching, see the sibling topics on sizing Collector memory and batching and on preventing data loss in the Collector. Those topics cover the settings in detail, so this section only sets the failure model you should size against.
Where agents and gateways fit in Kubernetes, VMs and regulated networks
In Kubernetes, the agent role is usually a DaemonSet that runs one Collector per node, so it can read container logs, node-level data and the Kubernetes metadata of the pods on that node. The gateway role is usually a Deployment behind a Service, placed per cluster or per region, where batching, retries and any credentialed export to the back end happen. Enrichment comes from the Kubernetes API and the node filesystem, which means the agent needs read permissions granted through a service account and RBAC rules, not through credentials stored in the back end.
- Placement: Node agents for logs and host signals, one gateway per cluster or region for export and heavier processing.
- Enrichment source: The Kubernetes API for pod, namespace and workload attributes, and the node for container log paths.
- Credentials: Service account tokens and RBAC for the agent, with back-end credentials held only by the gateway.
- Network: Confirm that node-to-gateway traffic is allowed by your network policies and that the gateway Service is reachable only from the cluster.
- Components: Confirm which receivers and processors your chosen distribution includes, since Kubernetes-specific components may be in contrib builds.
Before you finalize the design, check that your cluster network policies allow agent-to-gateway traffic, and confirm which Kubernetes components your Collector distribution includes.
On virtual machines and bare-metal servers there is no scheduler to place Collectors for you, so the agent is a host service managed by your configuration tooling. Agents typically read local log files and host metrics, then forward to a gateway or directly to a back end. Enrichment depends on what the host knows about itself, such as hostname, cloud instance metadata or tags you assign through configuration management. Credentials for the gateway must be delivered to each host without being copied into shared images.
- Placement: An agent per host as a systemd service, with a gateway in each data center or cloud region that hosts the fleet.
- Enrichment source: Host attributes set in configuration, cloud instance metadata where available, and resource tags from your inventory system.
- Credentials: Per-host or per-group certificates or tokens delivered by your secrets tooling, with file permissions that restrict who can read them.
- Network: Confirm firewall rules between hosts and gateways, and whether hosts can reach the gateway address directly when they sit on separate subnets.
- Components: Confirm which filelog and hostmetrics components your distribution includes, and which operating systems each component supports.
Before rollout, test one host group end to end and confirm the enrichment attributes arrive at the gateway as expected.
Multi-region and air-gapped environments add constraints that change the placement decision. Agents may need to send only to a regional gateway, because cross-region or outbound paths may be restricted or may be reviewed for data residency. In an air-gapped network, the Collector binaries, component dependencies and configuration must be delivered through an approved internal channel, and any update path must be planned around that restriction. Credentials usually need to be issued from an internal certificate authority or identity system rather than from a public service.
- Placement: Agents in each network zone, regional gateways that stay inside the zone or region, and a clear rule for what may leave each zone.
- Enrichment source: Internal inventory or configuration data, since public cloud metadata services may be unavailable or restricted.
- Credentials: Certificates or tokens from your internal certificate authority or identity provider, with a rotation process that works without internet access.
- Network: Confirm which zones may connect, which ports and protocols are approved, and whether a proxy or diode sits between zones.
- Components: Confirm that every component can be built or delivered internally, and record the versions you approved.
Before committing to a design, ask your network and security teams which flows are allowed across each boundary and how new Collector releases will be delivered into the isolated network.
Setting up agent and gateway tiers in order
This sequence takes a team from an undecided telemetry layout to a tested two-tier Collector setup, with each signal routed through the tier that fits it. Each step closes with a check so problems surface before the rollout reaches production workloads.
Inventory signals and telemetry sources
List every source that produces traces, metrics and logs: services, hosts, Kubernetes clusters, network segments and any existing shippers. For each source, record the signal types, expected volume, network zone, and whether it can reach a central endpoint. Note which sources hold regulated or sensitive data, because those decide where redaction and credentials must sit. Done when every source has an owner and a row in the inventory, and the platform team has signed off that nothing is missing.
Pick the pattern for each signal
Using the inventory, decide per signal whether it runs through agents only, a gateway only, or both tiers. Agents suit local collection, host and file reads, and failure isolation for a single workload. Gateways suit centralized credentials, enrichment across many sources, and stateful processing. Record the decision and the reason for each signal in the design document. Done when each signal has a named pattern and a reviewer from security and platform engineering has accepted the trade-offs in writing.
Choose the distribution and pin the version
Select the Collector distribution that contains the receivers, processors and exporters your design uses, and pin one release version for both tiers. Check the release notes and the stability level documented in each component's README before relying on it, since core components have mixed stability. Verify the signed artifacts, SHA256 checksums and SBOM files for the chosen release. Done when the version, distribution and component list are recorded and every host can pull the same artifact.
Build the gateway configuration
Write the gateway configuration with receivers that accept OTLP from agents, processors for memory limiting, batching and any required enrichment, and exporters to the back ends. Bind server components to addresses that the design allows, keeping in mind that recent Collector versions bind to localhost by default. Store the file in version control and keep secrets out of it. Done when the configuration validates with the Collector's config check and a test span, metric and log each reach the exporter path on a staging gateway.
Add the agent configuration pointing at the gateway
Write the agent configuration that collects local signals and exports them over OTLP to the gateway endpoint. Keep agent processing light so a single host failure stays contained, and move cross-source enrichment to the gateway. Confirm the agent resolves the gateway name and that TLS settings match on both sides. Done when an agent on a staging host delivers its data through the gateway and the gateway logs show the expected source attributes.
Add authenticator extensions on both tiers
Configure authenticator extensions so the gateway authenticates incoming agent connections, for example with OIDC where the design calls for it, and so agents attach credentials to outgoing requests, for example through the oauth2client extension. Store client secrets in a secrets system, not in the file. Test that an agent without valid credentials is refused and that an agent with valid credentials is accepted. Done when both the rejection and acceptance tests pass and the credential rotation owner is named.
Roll out to one zone first
Deploy the gateway and the agents to a single zone or cluster that carries low-risk traffic. Keep the previous collection path running in parallel until the new path has been checked. Watch refused-data and queue signals during the rollout and be ready to revert agents to the old endpoint. Done when the pilot zone runs through its normal load without dropped data attributed to the new tiers and the owner accepts the pilot.
Verify with the debug exporter and self-telemetry
Temporarily add the debug exporter to both tiers to confirm the exact records passing through each processor, then remove it or limit its verbosity before wider use. Enable Collector self-telemetry and check that accepted, refused and exported counts match between the agent and gateway. Confirm that sensitive attributes are removed by the redaction processor where required. Done when the counts reconcile across both tiers, the redaction checks pass, and the results are recorded as the baseline for later changes.
Securing credentials, endpoints and configuration across tiers
Agent and gateway Collectors each hold credentials, accept inbound telemetry and read configuration that can route data to a back end. The controls below decide who can reach each tier, which secrets it carries and who can change its pipeline, so review them per tier rather than once for the whole design.
Bind server components deliberately
Since Collector v0.110.0, server components bind to localhost by default rather than 0.0.0.0. Any receiver that accepts traffic from other hosts, such as OTLP on an agent or a gateway, must be exposed on purpose. Check each receiver's endpoint setting, confirm which network interfaces it listens on, and restrict reachability with firewall rules or Kubernetes network policies that match your tier layout.
Security best practicesAuthenticate inbound connections
Authenticator extensions can check the identity of clients sending data to a receiver, for example with OIDC tokens. On a gateway, this decides which agents, workloads or regions may write telemetry at all. Agents forwarding to a gateway can use mutual TLS or tokens, but you must confirm which authenticator each receiver supports in the component README before relying on it.
Collector configurationAttach credentials to outbound exports
Exporters that send to a back end often need tokens or client credentials. The oauth2client extension can add these to outgoing requests, so the credential lives in the Collector instead of in each application. Decide per tier who holds the back-end secret: agents usually should not, while a gateway may hold it. Rotate these credentials on a schedule your identity team can audit.
Store configuration and secrets securely
Collector configuration files often contain endpoints, tokens and tenant identifiers. Keep them out of container images and source repositories in plain text, store secrets in your secret manager, and encrypt configuration at rest and in transit. Confirm how your deployment tooling injects environment variables into the Collector process and who can read the pod spec or host files.
Redact sensitive attributes before export
Application spans and logs often carry tokens, session identifiers, query text or personal data. The redaction processor removes or masks attributes that match your rules. Place it in the agent when sensitive data should never leave the workload host, or at the gateway when one policy must cover every source. Test rules against sample payloads before they reach production.
Security best practicesBuild only needed components and limit config changes
Use the Collector Builder to include only the receivers, processors and exporters each tier needs, which shrinks the attack surface and the set of components to patch. Pair the smaller build with change control: require review for gateway pipeline edits, restrict who can roll out new configuration, and keep an audit trail of which build and configuration version runs in each region.
Collector docsQuestions buyers ask before choosing agent or gateway placement
What drives the cost of an agent pattern versus a gateway pattern?
The main cost difference is where the work and the running capacity sit. An agent layer runs one Collector beside every workload, so cost grows with node and workload count and with configuration effort across many hosts. A gateway layer runs fewer, larger Collectors, so cost concentrates in compute, memory, queue storage and the network path to the back end. Both patterns carry design, testing and rollout work that is paid once, plus recurring costs for upgrades, configuration changes and on-call. When you ask a partner for a quote, ask them to itemize the design, build, rollout, testing and handover work separately, state which items recur, name the environments in scope (clusters, regions, data centers) and list which back-end owners and security reviews are included. A quote that does not show these components is hard to compare.
How long does designing and rolling out Collector placement take?
Duration depends on how many environments are in scope, how many signals and sources each one carries, and how many teams must approve changes. The main drivers are the number of clusters, hosts and regions, whether agents must be rolled out to existing workloads without downtime, how many back ends receive data, and how long security and network reviews take in your organization. Teams that already run configuration management and have a single back end usually move faster than teams that must coordinate several owners. Ask any partner to tie the timeline to named milestones: discovery, a reference design, a lab or staging rollout, a production wave by environment and a handover. Ask which steps depend on your change windows and which depend on third parties such as network or identity teams.
What does the work need from our team?
Expect to provide access and decisions rather than hands-on build time alone. The usual inputs are cluster or host access for the rollout account, network paths and firewall rules between agents, gateways and back ends, named owners for each back end, and a security sign-off on where credentials, certificates and telemetry content are stored and sent. Your platform team should confirm how Collectors will be deployed and updated, such as through Helm, the Operator, configuration management or a pipeline, and who approves changes to shared gateway configuration. Ask a partner to write down the access list, the named contacts and the decision points before work starts, so delays are visible early.
Can our own team design and run agent and gateway placement?
Often yes, if your team already operates Kubernetes or Linux fleets, understands OTLP exporting and has a clear owner for each back end. The gap is usually in failure testing, sizing, credential handling and the routing decisions that are hard to undo, such as whether a gateway needs stateful routing for tail sampling. Build it in-house when the scope is one cluster or one region, the back end is stable and your team has time for a lab rollout. Consider a partner when several regions, regulated data, multiple back ends or a tight deadline are involved, or when you want an independent review of the design before rollout. Either way, ask for the design document, the test results and the runbook as deliverables.
Can we add a gateway later if we start with agents only?
Yes, in most setups. Agents that export to a backend endpoint can usually be pointed at a gateway later by changing the exporter endpoint, which is why many teams start with agents and add a gateway when they need central processing, credential isolation or a single egress point. The work to check is what the agents currently do: if they already perform processing such as attribute changes or sampling, that logic must be moved or duplicated so behavior does not change during the move. Also check how the gateway will receive traffic, its TLS and authentication settings, and whether the back end accepts the new source identity. Ask a partner to include a rollback path in the plan.
When is a two-tier gateway needed, and what does it add?
A two-tier design is needed when some processing must see all the spans or data for one unit, such as all spans of one trace for tail sampling. In that case a first tier routes data by a key to the correct second-tier Collector. The second tier adds more moving parts: routing configuration, resolvers that track which Collector owns which key, and extra capacity and monitoring. If you do not need trace-level or stateful processing, a single gateway tier usually keeps operations simpler. Ask a partner to state which processing needs routing, how they will test that a trace is never split, and how scaling changes will be handled.
What breaks most often when agents and gateways are mixed up?
The common failures are duplicated processing, where the same sampling or redaction runs in both tiers with different rules, and silent data loss when a gateway queue fills during a back-end outage and an agent has no buffering. Another frequent problem is credentials: gateways that hold back-end tokens for every source make a single compromise expensive, and agents that carry those tokens spread the secret. Check that each processing step has one owner, that queue and memory limits are tested under load, and that refused or dropped data is measured. Ask a partner to show the failure tests they plan to run, such as a back-end outage and a gateway restart, and to report the results.
What a scoped Collector placement engagement covers
A placement engagement starts with a written scope that names the environments in scope, the signals that will flow through the Collectors (traces, metrics and logs), the back ends they export to, and the teams that own each layer. The central deliverable is a placement decision: which workloads get an agent Collector, which traffic goes through a gateway, where each gateway sits (per cluster, per region or per account), and why. The decision is written against the failure-isolation, enrichment, credential and cost trade-offs your environment actually presents. Alongside it, the engagement produces the Collector configurations for each tier, including receivers, the exporters block, authenticator settings and the memory_limiter and batch processors, plus a verification record showing that data arrives at each back end with the expected attributes and that credentials are scoped to the tier that uses them.
Handover is designed so your team can run the result without us. You receive the configuration repository, the deployment manifests or Helm values, the verification scripts and test results, runbook notes on what to check when a gateway falls behind, and a short record of the decisions and their assumptions. Items that depend on your environment, such as the exact Collector release you standardize on, the secrets store that holds exporter credentials, and whether your network policy allows agents to reach gateways directly, are listed as open confirmations in the scope rather than assumed. Ongoing work such as Collector upgrades, configuration changes as new services onboard, and periodic re-testing of the placement can be covered under a retainer for upgrades and support, agreed separately from the fixed-scope work. Ask any quote to itemize the placement design, configuration, verification and handover, and to state which of these recur.
How DeployOpen works on this
DeployOpen plans, implements, hardens, documents and supports self-hosted OpenTelemetry Collector tiers inside your own cloud accounts, data centers or air-gapped networks. We start from your failure domains, credential boundaries and telemetry volumes, then agree the agent and gateway split in writing before any configuration is built.
How we scope
- Inventory which workloads, hosts and clusters need agents and which need a gateway tier
- Record enrichment, credential and network boundaries for each tier before choosing components
- Agree a fixed scope, deliverables and timeline in writing before work starts
How we build
- Build agent and gateway configurations from the Collector release you select and pin
- Test failure isolation by stopping the gateway tier and checking agent queues and retries
- Verify authenticator extensions, TLS settings and redaction rules against your security requirements
How we hand over
- Deliver configuration files, deployment manifests and a written record of the tier design
- Document the Collector's own health metrics, queue alerts and the steps for a tier outage
- Walk your platform and security teams through the runbook and the decisions behind each tier
How we support
- Offer ongoing support, upgrades and continuous testing as a retainer after handover
- Review Collector release notes and component stability levels before each planned upgrade
- Retest tier changes when new workloads, back ends or credential models are added

