Why Collector secrets management matters before the first pipeline ships
This page is for the platform, observability and security engineers who are about to wire OpenTelemetry Collector exporters to back ends that require API keys, and receivers that terminate TLS with private keys. It covers how to keep those credentials out of Collector configuration files and Git, how to inject them at runtime, and how to rotate them without redeploying pipelines. Get this right before the first pipeline ships, because the Collector is where those credentials end up.
OpenTelemetry is vendor- and tool-agnostic, so the standard itself does not hold your back-end credentials. The Collector does. Whether you run it as an agent next to services or as a gateway that accepts data from many sources, it is the component that authenticates to your observability back ends and presents certificates to the SDKs sending it data. Authenticator extensions such as oauth2client add credentials to outgoing exporter requests, so a single Collector configuration can hold keys for every destination in your estate. The OpenTelemetry Collector documentation describes these agent and gateway roles, and that is where your exposure is concentrated.
OpenTelemetry's security guidance asks you to store Collector configuration securely and to use encryption and authentication, so treat the configuration file as a sensitive artifact from day one. Before the first pipeline ships, confirm where each credential will live, who can read it at runtime, and how a leaked key would be revoked. Ask your back-end vendors which authentication methods they support for the Collector, and confirm how your chosen Collector distribution handles environment variable expansion and extension configuration in your deployment method. Those answers determine the rest of this page.
Secret delivery options for Collector configuration
This table compares four ways to get back-end API keys and TLS material into an OpenTelemetry Collector without writing them into configuration files or Git. Read each row for the fit, what the approach protects, what it still exposes and what to confirm in the Collector distribution you chose. The main takeaway is that every option moves the secret somewhere else, so the question is who can read it at rest and at runtime.
| Delivery option | Fit and what it protects | What it leaves exposed | What to confirm |
|---|---|---|---|
| Environment variable expansion | Fits small deployments and containers where the Collector config references values such as ${env:...}. Keeps literal keys out of the YAML file and out of Git. | Values sit in the process environment, so anyone who can read the pod spec, host process or container inspect output can see them. Logs and crash dumps can capture them if careless. | Confirm which config providers your Collector build supports and whether the expansion syntax matches your release. Confirm how your platform restricts reading environment variables. |
| Kubernetes Secrets mounted as environment variables | Fits clusters that already manage Secrets. Keeps values out of manifests and lets teams rotate by updating the Secret and restarting pods. | Secrets are base64-encoded, not encrypted, unless encryption at rest for etcd is enabled. Any principal with get access in the namespace can read them, and env vars are visible to exec sessions. | Confirm etcd encryption at rest is enabled, namespace RBAC limits Secret reads, and that a restart is needed after rotation in your deployment method. |
| Kubernetes Secrets mounted as files | Fits workloads that read certificates and keys from disk, such as TLS for OTLP receivers and exporters. Avoids putting private keys in environment variables. | Mounted files are readable by the container user, so file permissions and the Collector's runtime user matter. Updates depend on how the kubelet refreshes volumes and whether the process reloads. | Confirm the Collector reloads certificate files or needs a restart, and that defaultMode and fsGroup restrict access to the intended user. |
| External secret store synced into the cluster or host | Fits organizations that already run a central vault or cloud secret manager and need audit trails and central rotation. The sync operator writes values into Kubernetes Secrets or host files. | The synced copy still exists in the cluster, so cluster admins can read it. Sync delay, failed syncs and stale values can cause outages if rotation is not monitored. | Confirm the sync tool, its refresh interval, its own service account scope and whether failed syncs alert. Confirm your store's audit logging covers reads. |
| File-based references written at deploy time | Fits VM and bare-metal hosts where a deploy job renders the config from a template and secret files on the host. Keeps templates free of values. | Rendered files on disk hold plaintext secrets, and CI logs or artifacts can leak them if the job echoes output. Rendering rights often exceed what the Collector needs. | Confirm file ownership and mode on rendered configs, that CI masks variables, and that rendered output is not archived as a build artifact. |
How to move Collector secrets out of Git step by step
This sequence takes a Collector configuration that holds back-end API keys and TLS keys as literals and turns it into one that references each secret at runtime, with read access limited and a commit check that blocks regressions. Each step ends with a check you can run before moving on.
Inventory every secret in the configuration
Someone on the platform team reads every Collector configuration file, Helm values file and deployment manifest, and lists each credential: exporter API keys, basic auth passwords, bearer tokens, OAuth2 client secrets, TLS private keys and any keys used by authenticator extensions. Record the file, the component and the key name for each entry, and note which environments share a value. The step is done when the list covers every environment and a search of the repository for common key patterns finds nothing that is missing from the list.
Remove literal values from files and history
Replace each literal with a placeholder reference in the working files, then rotate every credential that has ever appeared in a commit, because removing it from the latest revision does not invalidate it. Rewrite history only with a tool your team has agreed on, and coordinate with anyone who holds clones, since rewritten history breaks their copies. The check is a repository scan of all branches and tags that returns no matches for the rotated values, along with confirmation from the back-end owners that the old values are revoked.
Choose a delivery mechanism for each secret
Decide, per secret, whether it comes from an environment variable, a file mounted from a Kubernetes Secret, an external secret store synchronized into the cluster, or a secret fetched by an extension your build includes. Factors include who rotates the value, whether the platform already runs a secret manager, and whether the Collector runs on virtual machines or Kubernetes. Record the decision in a table with the owner for each row. The check is that every entry in the inventory has a mechanism and an owner, and that no mechanism depends on a component your Collector build does not contain.
Reference secrets through environment variables or mounted files
Edit the Collector configuration so each sensitive field uses environment variable expansion, for example by writing the variable name in the configuration, or points to a file path for certificate and key fields that accept file references. Confirm the exact syntax for your Collector version in the configuration documentation before editing, because expansion rules and file-reference fields differ between components. The check is a dry run where the configuration is rendered with placeholder values, showing that every sensitive field now holds a reference and no field holds a value that resembles a real key.
Lock down read access to secret sources
Restrict who and what can read the secret material: limit the Kubernetes Secret or secret store path to the Collector service account in its namespace, set file permissions so only the Collector user can read mounted key files, and remove access for CI jobs that do not deploy the Collector. Keep the Collector process non-root where your deployment allows it, since that controls which files it can open. The check is an access test run from a second workload or user account, which should fail to read the secret, and an audit of who can edit the secret objects.
Add a commit check that blocks literal keys
Add a pre-commit hook and a required CI job that scan changed Collector configuration and Helm values files for patterns that look like API keys, tokens and private key headers, and fail the pipeline when a match appears outside an approved placeholder syntax. Pair it with a secret scanner that runs on the full repository on a schedule. Test the check by committing a fake key on a throwaway branch and confirming that the pipeline fails. The check is a recorded failing run and a passing run after the placeholder is restored.
Verify the Collector starts and exports with injected values
Deploy the change to a non-production environment and confirm the Collector process starts, reports its configuration as loaded, and exports telemetry to the back end using the injected values. Watch the Collector's own logs for authentication errors and for any message that echoes a secret value, since logs are a common leak path. Then check the back end to confirm that data arrives under the expected tenant or project. The check is a received test span, metric and log line, plus a log review that finds no secret values, before the same change is promoted to production.
How a secret reaches the Collector without touching the repository
The Collector configuration in Git holds only placeholders such as ${env:BACKEND_API_KEY}, so the repository never contains the key itself. The secret starts in a secret store or a Kubernetes Secret, and the deploy step or runtime injects it as an environment variable into the Collector pod or host at start. The trust boundary sits between the repository and the runtime: check that no rendered configuration is written back to Git, that the secret store controls who can read values, and that the Collector's logs and debug output do not echo expanded values.
Git holds placeholders; secret values enter only at runtime, across a marked trust boundary.
Security controls that keep Collector credentials contained
Storing a secret safely is only half the job. The controls below limit who can read credentials, where they appear, which pipelines can use them, and what a compromised Collector process can reach. Each one is a decision your team should make and verify for its own environment.
Restrict who can read secrets
Limit read access to Kubernetes Secrets, secret store paths and the files that hold Collector configuration to the people and service accounts that deploy or run the Collector. Broad read access in a namespace exposes every credential in it, including those used by other workloads. Review role bindings, service account tokens and store policies, and confirm that CI pipelines and developers cannot list secret values by default. Include Git repositories and build logs in this review, because they are common copies of configuration.
Store configuration securely
The OpenTelemetry security guidance recommends storing Collector configuration securely and protecting it with encryption and authentication. In practice, this means keeping the configuration in a controlled location with restricted write access, using encryption at rest for the volumes and backups that hold it, and tracking changes through reviewed deployments. Ask who can change the configuration and whether those changes are logged.
Collector security practicesKeep secrets out of logs and debug output
Collector logs, the debug exporter and zPages can print configuration values or exported attributes when troubleshooting is turned on. A key placed in an exporter header or an attribute can then appear in plain text in log storage. Set log levels deliberately, avoid the debug exporter in production, and test a sample pipeline to confirm that credentials do not appear in its output. Pair this with the redaction processor for telemetry content.
Scope secrets to each pipeline
Give each pipeline, tenant or back end its own credential rather than one shared key. If a single token reaches every exporter, one leak exposes all destinations and makes rotation a coordinated outage. Separate credentials let you rotate one back-end key without touching others, and they make audit trails tell you which pipeline used which key. Ask your team to map each credential to its consumers before rollout.
Encrypt TLS private keys at rest
Receiver and exporter TLS private keys are as sensitive as API keys, and a copied key allows impersonation of your Collector endpoints. Store key files encrypted or in an external secret store, restrict file permissions to the Collector user, and keep them out of container images and Git. Confirm how keys are provisioned, renewed and removed from old nodes, and document who holds the key material for recovery.
Run with least privilege
A compromised Collector process should not be able to read secrets it does not need. Run the Collector as a non-root user with a service account that can read only its own secrets, and avoid host access unless host metrics or node logs require it. Those privileged deployments should be separate from gateways that only receive and forward data. Verify the result by attempting to read an unrelated secret from inside the running Collector.
How to rotate Collector credentials without dropped telemetry
Rotating a Collector credential safely follows a fixed order: issue the new credential first, then update the secret source, roll the Collectors so they read the new value, and revoke the old credential last. Revoking early is the most common cause of dropped telemetry, because exporters that still hold the old key start receiving authentication failures and, depending on their retry and queue settings, data can be discarded once retries run out. Keep the old credential valid until every Collector that uses it has restarted or reloaded and you have confirmed exports are succeeding with the new one. Where your back end supports two active keys at once, use that overlap window rather than swapping a single key in place.
TLS certificates need a separate decision. Whether a receiver or exporter picks up a renewed certificate without a restart depends on the component and the Collector version, so confirm the behavior for each one you run, using the component README and the Collector configuration documentation as your starting point. Record which components reload certificates in place, which need a restart, and how a failed reload is reported. Also plan for mixed generations: during a rolling restart, agents and a gateway may briefly hold different keys or trust different CA bundles. If the gateway has already dropped the old trust chain while agents still send with the old certificate, those connections fail. Keep the old and new trust anchors valid together until the rollout finishes.
Test the whole sequence in a non-production pipeline before touching production. Send continuous synthetic traces, metrics and logs through the same receivers and exporters, rotate each credential type on its own, and watch the Collector's own telemetry for refused connections, export failures and queue growth. Confirm that the new value is actually read after reload and not cached from the previous run. Ask your back-end vendor whether it supports overlapping keys, and document the rollback step for each credential, so the on-call engineer knows whether reverting means restoring the old key or simply re-pointing the secret reference.
Limits to confirm before choosing a secrets pattern
Each secrets pattern for the Collector depends on what your specific build, distribution and runtime support. The checks below connect the pattern you choose to the components, syntax and tooling you actually run, so you find gaps before configuration files reach Git.
Auth and TLS settings per component
Not every receiver and exporter in your build accepts the same authentication or TLS fields, and some expose credentials only through specific extensions. Confirm in each component's configuration reference that the key you need, such as a token, client secret or certificate path, is supported. The oauth2client extension can add credentials to outgoing exporter requests, so check whether your back-end exporter works with it before you plan around it.
Collector configuration docsExpansion syntax in your distribution
Environment variable expansion is a configuration feature, but the exact syntax and the places it applies can vary with the Collector version and distribution you deploy. Test the expansion form you plan to use, such as a variable inside an exporter header or a TLS file path, against the exact release in a non-production environment. Confirm the behavior when a variable is unset, because a missing value can silently produce an empty credential.
Stability level of each component
Core Collector components have mixed stability levels, and each component's README documents its status for each signal. A secrets-handling option on a component still in development may change between releases, which affects how you rotate and redeploy credentials. Record the stability of every auth and exporter component in your build, and plan upgrades around any that are not yet stable.
OpenTelemetry status pageSync path from secret store to runtime
External secret stores reach the Collector only through a sync mechanism, such as a Kubernetes operator, a sidecar or an injected volume. Confirm that your store has a supported path into the runtime you use, and that the path refreshes values when a secret rotates. Without a refresh path, a rotated key stays in memory until the Collector restarts, so ask who owns the sync job and how its failures are alerted.
Audit logging of secret reads
Your compliance and security teams will want evidence of who or what read a back-end API key or TLS key, and when. Check whether your secret store records read events, whether those logs can be exported to your SIEM, and how long they are retained. If the store cannot log reads for the identity the Collector uses, plan a compensating control such as narrow access policies and regular access reviews.
Credentials in logs and config dumps
Collector debugging output and configuration views can expose values that were expanded at startup. Confirm how your chosen pattern handles these outputs, including whether the debug exporter, zPages or logged startup configuration can show expanded secrets. Test that a deliberately placed test value does not appear in logs before you allow the pattern into production.
Questions teams ask before moving Collector secrets
What drives the cost and effort of moving Collector secrets out of configuration?
The effort follows the size of the inventory: how many back-end API keys, TLS keys and other credentials the Collector configurations reference, how many Collector deployments read them, and how many environments (development, staging, production, disaster recovery) each one runs in. A team that already runs a secret store and has a GitOps workflow has less to build than one that stores credentials in files on hosts. Ask any partner to base a written quote on a counted inventory of secret references per deployment and per environment, and to state which items are one-time work (moving values, changing configuration, testing) and which recur (rotation, reviewing new components, audits of access).
How long does a secrets migration for the Collector usually take?
Duration depends on scope rather than on a fixed rule. The main variables are the number of Collector deployments, whether environment variable expansion is enough or a Kubernetes secret or external store must be introduced, how many change windows the production estimate needs, and how many teams must confirm their back ends accept rotated credentials. The written scope should list the phases (inventory, design, pilot in one environment, production cutover, rotation test) with a timeline for each, and say which client-side dependencies could extend it. DeployOpen agrees timelines in writing before work starts.
What does the work need from our team?
It needs named access and people. Typically that means read access to the Collector configuration repository and deployment manifests, administrative access to the chosen secret store or Kubernetes namespaces, and a change window for each environment. Each back end also needs an owner who can issue a new credential, confirm the old one can be revoked, and say which tenant or project the key belongs to. Engineers who deploy the Collector should review the changes, because they know which receivers and exporters run in which environment. Confirm these roles and approval paths before the quote is signed.
Can our team move Collector secrets without outside help?
Often yes, if the team already operates Kubernetes or a secret store and has time to test each exporter after the change. The harder parts are usually the inventory (finding every place a key appears, including old Git history and host files), testing rotation without downtime, and keeping the Collector's own permissions narrow while it reads secrets. An outside partner adds most value on those points and on documentation for later reviews. Your team can ask for a written scope that you run alone, one that a partner runs with your staff, or one that a partner runs and hands over.
How is credential rotation handled after the move?
Rotation is a repeatable procedure, not a one-time event. The usual pattern is to issue a new credential in the back end, store it in the secret location, let the Collector pick it up (which typically requires a reload or restart, so confirm how your deployment handles that), verify that data still flows, and then revoke the old credential. Check the specific authenticator or exporter documentation for how it reads updated values, because some components only read credentials at startup. Write the rotation schedule, the owner for each back end and the rollback step into the runbook.
Does DeployOpen issue a certification for the secrets setup?
No. DeployOpen plans, implements and documents the configuration, and can prepare evidence such as access records, configuration reviews and rotation procedures for your compliance team. It does not issue audit reports, attestations or certifications. Any formal assessment of the result is performed by an independent auditor or certification body that your organization selects, and the written scope should list which evidence will be delivered so your assessor can review it.
Which secret management options should we compare before deciding?
Compare environment variable expansion, Kubernetes secrets and an external secret store on four points: how the values reach the Collector process, who can read them, how rotation reaches running pods or hosts, and how the store is audited. Environment variables are the simplest starting point but still need a source outside Git. Kubernetes secrets fit clusters where access is already managed through role-based policy. An external store suits organizations that already keep credentials there. Confirm the chosen approach with the Collector configuration documentation and with your security team before design begins.
How DeployOpen works on this
DeployOpen plans and implements secrets handling for self-hosted OpenTelemetry Collector configuration inside your own infrastructure. We start from where back-end API keys and TLS keys live today, then move them out of configuration files and Git into a delivery method your security and platform teams can review.
How we scope
- Inventory every exporter, extension and receiver that holds a credential, certificate or token in the current configuration.
- Agree which secret source fits your environment, such as Kubernetes secrets or an external secret store you already operate.
- Write the scope, deliverables and timeline in advance, since most engagements are fixed-scope.
- Confirm rotation ownership, access roles and which teams approve changes to Collector secrets before work starts.
How we build
- Replace hardcoded keys with environment variable references and configure the Collector to read them at startup.
- Wire authenticator extensions such as oauth2client to supply credentials to exporter requests without storing them in files.
- Test that secrets are absent from configuration files, container images, logs and Git history before any cutover.
- Set up the Collector deployment so only the pods or services that need a given secret can read it.
How we hand over
- Deliver the written configuration, secret source layout, and the mapping of each secret to the component that uses it.
- Document the rotation procedure, including the steps to update a key and restart or reload the Collector safely.
- Provide the test results showing where secrets were checked and what was found and fixed.
- Walk your operations team through troubleshooting for authentication failures after a rotation.
How we support
- Ongoing support, upgrades and continuous testing are available as retainers after the initial handover.
- Retainer work can cover rotation support, checks after Collector upgrades, and review of new exporters added to pipelines.
- Confirm with your team which secret store version, Kubernetes version and Collector release your environment runs before scoping.

