How OpenBao Kubernetes secrets injection gets secrets into pods
Workloads need database passwords, API keys and certificates, and copying them into manifests or native Kubernetes Secrets creates long-lived exposure that outlasts the pod that needed them. OpenBao delivers secrets to pods through Kubernetes authentication and one of two documented delivery methods: the Agent Injector or the CSI provider. Both start from the same identity question: which service account is this pod running as, and which OpenBao role does that service account map to. Each service account gets its own Kubernetes auth role, bound to the namespace and service account names it is allowed to use, and attached to a policy that grants read access only to the paths that workload needs.
The choice between the two methods is a design decision, not a formality. The Agent Injector adds a sidecar container that authenticates, renders secrets into a shared volume and can keep them refreshed while the pod runs. The CSI provider mounts secrets through the Secrets Store CSI Driver, which suits teams that already run that driver or want secrets exposed as volume mounts without a sidecar. Ask which method your platform team already supports, how each one handles secret rotation and pod restarts, and who owns the admission webhook or driver lifecycle during upgrades. Reasoning about this early matters because the Kubernetes secrets good practices page notes that Secrets are stored unencrypted in etcd by default, so administrators must configure encryption at rest and restrict access to Secrets whichever path you choose.
Before rollout, confirm the exact Helm chart, injector and CSI provider versions against the OpenBao Kubernetes documentation for the release you run, since chart behavior and supported Kubernetes versions change between releases. Check the Kubernetes version your clusters run against the Kubernetes release cycle, and test one service account end to end in a non-production namespace: confirm the role binds only the intended namespace and service account, the policy denies reads outside its paths, and the secret file disappears or refreshes as expected when the lease or source changes. OpenBao on GitHub is the natural place to track release notes for the OpenBao side of the integration.
What your cluster and OpenBao need before injection
Injection only works when the OpenBao cluster, the Kubernetes cluster and the identity layout between them are ready first. Each item below is a dependency the injector or CSI provider relies on, and each one is cheaper to fix before the first pod starts than after secrets are flowing.
A running, reachable OpenBao cluster
Injection needs an OpenBao cluster that is initialized, unsealed and reachable from pod network addresses, not only from administrator workstations. Confirm the service address the injector will call, the active node behavior under your storage choice, and whether network policies allow traffic from the workload namespaces to the OpenBao listener. Test reachability from inside a pod before writing any roles, because a failure here looks like a authentication error later.
OpenBao HA docsA supported Kubernetes version
Confirm the minor version your cluster runs before you pick an injection method, since patch support and API behavior depend on it. Kubernetes maintains the three most recent minor releases, so check your version against the Kubernetes releases page and plan an upgrade before a line leaves support. Ask your platform team whether the cluster is on a managed distribution with its own upgrade schedule.
Kubernetes releasesKubernetes auth method enabled
Enable the Kubernetes auth method in OpenBao and configure it with the cluster API endpoint and the CA certificate that signs the API server certificate. The OpenBao server must be able to validate service account tokens, which means it needs a token it can use for review calls or a documented alternative for your version. Record the API endpoint and CA bundle in your change record so rotations do not break logins.
OpenBao auth methodsTLS on OpenBao endpoints
Both the injector and the CSI provider call OpenBao over HTTPS, so the listener needs a certificate that the workload side trusts. Decide who issues the certificate, how the CA bundle reaches the injector configuration, and how renewal is handled before expiry. Self-signed certificates are common in test clusters, but production teams should confirm their internal CA chain is mounted where the injector pod can read it.
Agreed namespace and service account layout
Write down which namespaces hold workloads, which service account each application uses, and which OpenBao policy each service account maps to. A one service account per application layout keeps Kubernetes auth roles narrow and makes audit logs readable. Ask the application owners to confirm the mapping before anyone creates roles, since renaming a service account later breaks every role bound to it.
How a pod receives its OpenBao secret
The flow starts when a pod presents its Kubernetes service account token to OpenBao through the Kubernetes auth method. OpenBao checks that token against the cluster API (token review), then matches the service account and namespace to a role and attaches the policies that role grants. The secret reaches the pod either through the Agent Injector writing a file from a sidecar or through the CSI provider mounting a volume. Check the trust boundary: the token review call and the role binding are the points where a misconfiguration exposes secrets to the wrong workload. This is a generic flow, not a vendor-verified sequence, so confirm the exact calls against the OpenBao and Kubernetes documentation for your versions.
Generic flow of a pod logging in to OpenBao and reading a secret.
OpenBao Kubernetes secrets injection: Agent Injector or CSI provider
The Agent Injector is a Kubernetes admission webhook that adds an OpenBao Agent container to a pod when the pod is created. You mark the pod template with annotations that name the secret paths, the Kubernetes auth role and the file template for each secret. The agent logs in with the pod's service account token, reads the secrets and renders them into a shared volume that the application container reads. Because the agent runs beside the application, the application can read files or environment values without OpenBao client code.
- Pod spec changes: The webhook edits the pod at admission, so the injected containers, volumes and environment settings appear in the live pod, not in the manifest you wrote. GitOps teams should expect diffs that differ from their source files.
- In-memory delivery: Rendered files go into a volume backed by memory, so secret files are not written to node disk. Confirm the volume medium for your chart version.
- Renewal inside the pod: The agent renews leases and re-renders templates when values change. Confirm whether your application can reload files without a restart.
- Per-pod overhead: Each pod carries an extra container, which adds CPU and memory to every replica and one more process to monitor.
- Webhook dependency: Pod creation depends on the injector being available. Plan its replica count and failure policy so an outage does not block scheduling of annotated pods.
Before adopting this model, confirm the annotation names for your chart version, the injector failure policy and whether each application handles file reloads.
The CSI provider path uses the Secrets Store CSI Driver, a Kubernetes storage interface that mounts external secrets as a volume. A provider plugin fetches values from the external store when the pod starts. You describe what to fetch in a SecretProviderClass object, and the pod references that object in a CSI volume. The Kubernetes secrets good practices page names this driver as one approach to using external stores for secrets.
- No sidecar: Secrets arrive as a mounted volume, so pods gain no extra container and the pod spec stays close to your manifest.
- Mount-time fetch: Values are read when the volume is mounted. Confirm how the driver handles rotation and whether a pod restart or a polling interval is needed to pick up new values.
- Optional native Secrets sync: The driver can create a Kubernetes Secret from mounted content. That copy sits in etcd, so encryption at rest and least-privilege RBAC must cover it.
- Provider plugin lifecycle: The OpenBao provider must be installed on the nodes, and its release cadence and version support are separate from the driver. Confirm support and ownership with the plugin maintainers.
- Node-level dependency: The mount must succeed before the pod starts, so failures typically appear as pods stuck in container creation. Build alerts for that state.
Before adopting this model, confirm the OpenBao provider release you will run, the rotation behavior of your driver version and who owns the plugin on your nodes.
Decide on four factors: whether your platform team accepts extra containers and pod spec changes, whether the application needs a native Kubernetes Secret, how quickly values must change after rotation and which skills your teams already have. Neither method fits every workload, so score each service against the same questions before you choose. Kubernetes auth roles bound to service accounts work with either method, so the auth design stays the same.
- Pod spec changes: Choose the injector only if an admission webhook and an extra container fit your change control. Choose CSI if pods must stay close to their manifests.
- Native Secrets: If workloads, ingress controllers or tools require a Kubernetes Secret object, the CSI sync option or External Secrets Operator may fit better. External Secrets Operator is covered on its own sibling topic.
- Rotation needs: Write down the rotation interval and whether each application can reload files without a restart. Test renewal behavior for each method in staging.
- Team skills: The injector needs staff comfortable with admission webhooks and chart values. The CSI path needs skills with CSI drivers, custom resources and node plugins.
- Mixed estates: Many organizations run both. Set one standard per workload class so roles, policies and access reviews stay consistent.
Write the decision down per workload class, then test a rotation and a node failure in staging before you standardize.
Configuring Kubernetes auth roles per service account
This sequence sets up OpenBao so that each Kubernetes workload authenticates with its own service account, receives a policy limited to its own secret paths, and reads only those secrets through the chosen injection method. Each step ends with a check that confirms the scope before the next step begins.
Confirm the cluster and OpenBao versions
The platform engineer records the Kubernetes version of the target cluster and the OpenBao version the team plans to run, then checks both against the current OpenBao release notes and the Kubernetes version skew policy. Confirm that the OpenBao server can reach the Kubernetes API from its network and that the cluster's API server certificate chain is trusted by the OpenBao host. The step is complete when the team has written down both versions and a reachability test from the OpenBao host to the API server succeeds. Confirm the exact Kubernetes auth method options for the chosen version in the OpenBao auth methods documentation before writing any configuration.
Enable and configure the Kubernetes auth method
A platform administrator with root or equivalent policy enables the Kubernetes auth method at its default path and writes its configuration, including the API server address and the CA certificate or token reviewer details the OpenBao docs require for the version in use. Decide whether OpenBao validates tokens through the TokenReview API with a dedicated reviewer service account, and document that choice. Confirm the exact subcommand and configuration keys in the OpenBao Kubernetes auth documentation for your version. The step is done when reading the auth configuration back returns the expected host and CA values, and a login attempt with a deliberately invalid token is rejected.
Write one least-privilege policy per workload
The security or platform team writes a separate policy for each workload, granting read capability only on the KV path that workload needs and nothing else. Keep paths per application or per namespace, avoid wildcards that cover sibling applications, and keep write and list capabilities out unless the workload needs them. Store the policy files in version control so changes go through review. The step is complete when each policy file is reviewed and loaded, and reading each policy back shows capabilities limited to the intended path. Reviewers should also check that no policy grants access to the root or sys paths.
Bind a role to one service account and namespace
For each workload, the administrator creates a Kubernetes auth role that binds exactly one service account name and one namespace, attaches the matching policy, and sets a short token time-to-live appropriate to the workload's restart pattern. Avoid binding a role to a wildcard namespace or to the default service account. Confirm the role field names and token settings in the OpenBao docs for the version in use. The step is done when reading each role back shows the expected bound service account, bound namespace and attached policy, and the role list contains no shared roles across unrelated workloads.
Deploy the chosen injection method
The platform team installs the injection component the team selected: the Agent Injector, which adds a sidecar to annotated pods, or the CSI provider, which mounts secrets as a volume through the Secrets Store CSI Driver. Install it through the method's documented Helm chart or manifests, pinned to versions that the team has tested together. Confirm the exact chart values, annotation names and CSI resource fields in the OpenBao Kubernetes documentation for the version in use. The step is complete when the injector or provider pods are running in their namespace and their logs show no authentication or certificate errors against OpenBao.
Annotate or mount a test workload
A developer deploys a test pod in a non-production namespace that uses the service account bound to one role, with the injection annotations or the CSI volume definition pointing at a single test secret path. Use an illustrative test secret that holds no real credentials. Confirm the annotation or volume attributes against the documentation for your version. The step is done when the pod reaches the Running state and the injection component reports a successful login for the expected role.
Verify the secret arrives with the expected scope
The team checks from inside the test pod that the injected secret file exists and contains the expected value, then attempts to read a secret path belonging to another workload and confirms the request is denied. Repeat the login test from the OpenBao side and confirm that the returned token lists only the intended policy. Record the test results with the role, policy, service account and namespace in the change record. The step is complete when the allowed read succeeds, the cross-path read returns a permission error, and the login output shows the expected policies and bound service account.
Mapping service accounts, namespaces and policies to OpenBao roles
This table shows how each Kubernetes object and OpenBao object links a workload to the secrets it can read. Read it top to bottom as a chain: the service account and namespace identify the workload, the Kubernetes auth role trusts that identity, and the OpenBao policy limits what the role can read. Each link is a place where access can widen by accident.
| Object | OpenBao or Kubernetes counterpart | What it controls | Common mistake |
|---|---|---|---|
| Service account | Identity presented to the Kubernetes auth method | Which pods share one OpenBao identity when they run under the same account | Reusing the default service account across unrelated workloads |
| Namespace | Bound namespace on the Kubernetes auth role | Which teams or environments can request the role's secrets | Binding a role to every namespace so new namespaces inherit access |
| Kubernetes auth role | Role in the Kubernetes auth method | Ties one bound service account and namespace set to one or more policies | Creating one shared role for many applications to save setup time |
| Bound audience or token settings | Audience and token behavior configured on the role | Which tokens the role accepts and how long the resulting OpenBao token lasts | Leaving audience checks loose or assuming the defaults fit production; confirm them in your OpenBao version |
| OpenBao policy | Policy attached to the role | The exact paths and capabilities the workload's token receives | Granting list or wildcard paths when a single read path is enough |
| Secret path | Path in a secrets engine referenced by the policy | The specific secret or dynamic credential the workload can read | Placing unrelated applications under a shared parent path that the policy covers |
| Pod label or annotation | Selector used by the injector or CSI provider configuration | Which secret a pod requests and which role it uses | Letting teams set the role or path annotation freely in their own manifests without review |
Why avoiding native Kubernetes Secrets matters for injected values
Injection matters because it keeps secret values out of manifests and out of etcd when the workload reads them directly from OpenBao. Native Kubernetes Secrets are stored unencrypted in etcd by default, according to the Kubernetes secrets good practices guidance, so any value copied into a native Secret sits in the cluster datastore unless the team has configured encryption at rest and restricted list and watch access with least-privilege RBAC. If you use the Agent Injector or the CSI provider, confirm that no step in your pipeline mirrors the fetched value into a Secret object, a Helm value or a ConfigMap. A single mirror step undoes the protection the injection pattern is meant to provide.
The trade-off is availability. An injected secret depends on the OpenBao cluster answering at pod start, and in the Agent Injector pattern the injected init or sidecar container cannot render the secret until OpenBao is reachable and the Kubernetes auth role accepts the pod's service account. A cluster-wide OpenBao outage can therefore block new pods from starting, while pods already running may keep their last rendered file until the lease or renewal path fails. Plan the OpenBao high availability design and the pod restart behavior together, and test a restart of the OpenBao cluster during a rollout in a non-production environment before relying on it. Also confirm how each application consumes configuration. Some applications only read environment variables, and environment variables from injected files need a wrapper or a template that exports them, which changes the startup path. Other applications read files directly and need no change.
Hardening OpenBao Kubernetes secrets injection
Secrets injection moves credentials from OpenBao into pods, so the security of the whole path depends on who can change pods, how Kubernetes stores and exposes Secrets, and how tightly OpenBao trusts each service account. The six controls below cover the Kubernetes side, the OpenBao side and the audit trail that ties them together. Use the CIS Kubernetes Benchmark as a reference to check your cluster against once the controls are in place.
Restrict who can edit pods and annotations
The Agent Injector works by reading annotations on a pod, so anyone who can create a pod or edit its annotations can request secrets under the pod's Kubernetes auth role. Limit create, update and patch rights on pods, deployments and their annotations to the teams that own each namespace. Review RBAC bindings for these verbs regularly, since a broad binding granted for debugging often remains after the debugging ends. Treat annotation edit rights as secret access.
Apply Pod Security Standards to secret consumers
Workloads that receive secrets should run under a restrictive Pod Security Standards level, so that a compromised container cannot easily reach the host, mount sensitive paths or run privileged. Enforce the level with namespace labels for the namespaces that hold injected workloads. Check that the injector and CSI sidecars are allowed by the policy and that exceptions are documented and narrow. The Pod Security Standards page describes the baseline and restricted profiles.
Pod Security StandardsLimit list and watch on Secrets
Any identity that can list or watch Secrets in a namespace can read every secret in that namespace, whether or not it needs them. Grant get on named Secrets only where a workload truly needs them, and keep list and watch to controllers that require them. The injection pattern reduces the need for native Secrets, but operators, CI tooling and older charts often still create them. Audit which service accounts hold these verbs with a cluster-wide query before you rely on the injection path.
Encrypt etcd where native Secrets remain
Kubernetes stores Secrets unencrypted in etcd by default, so any Secret that remains in use, such as a bootstrap token or a Helm release value, is exposed to anyone who reads etcd snapshots or backups. Configure encryption at rest for the Secret resource in the API server, and confirm that existing Secrets were rewritten after the change. Include etcd backups in the same review, because a snapshot made without encryption defeats the setting. Ask your cluster distribution how it manages the encryption key.
Secrets good practicesScope OpenBao policies and Kubernetes roles
Each Kubernetes auth role should bind one namespace and one service account to one OpenBao policy that lists only the paths that workload reads. Avoid wildcard bound service accounts and shared policies that grant access to several applications. Keep token TTLs short and confirm that a role cannot be used from a namespace it was not written for. Review the roles whenever a workload is retired, since an orphaned role keeps its trust relationship.
OpenBao auth methodsEnable audit logging on both sides
A useful investigation needs two records: OpenBao's audit device, which logs authentication and secret reads, and the Kubernetes API audit log, which records who created or changed pods, annotations and service accounts. Enable both, send them to storage the workload owners cannot edit, and set retention with your compliance team. Test that a single secret read can be traced from the Kubernetes service account to the OpenBao request, because that correlation is what an incident responder will need.
Where OpenBao Kubernetes secrets injection fails
This table lists the failures teams most often hit when delivering OpenBao secrets to pods, with the likely cause and a check you can run for each. Read it in order when a pod will not start or a secret is wrong, since several symptoms share a root cause. The main takeaway is that most failures trace to the Kubernetes auth role binding, the API server address or CA, or the namespace security settings, and each can be checked before changing OpenBao policy.
| Symptom | Likely cause | Fix |
|---|---|---|
| Pod stuck in Init or Pending because the secret cannot be fetched | The injector or CSI provider cannot reach OpenBao, or the pod's login fails before any secret is read | Check the injector or provider logs, then run a test login from a debug pod using the same service account token and confirm the OpenBao address resolves from inside the cluster |
| Permission denied from a valid service account | The Kubernetes auth role names the wrong namespace or service account, or the policy does not cover the secret path | Compare the role's bound service account names and bound namespaces with kubectl get sa output, then read the role and the attached policy with the OpenBao CLI |
| Token review failures after login | The kubernetes auth config points at the wrong cluster API address, or the CA certificate or reviewer token is outdated | Confirm the configured Kubernetes host and CA match the cluster, verify the reviewer service account can create token reviews, and reconfigure the auth method if the cluster certificates changed |
| Secrets not refreshing after rotation | The workload reads the secret once at startup, or the template or renewal settings do not re-render the file | Check whether the injected file updates in the running pod, confirm the template re-renders on change, and restart the pod only if the application cannot reload the file |
| Pods receiving the wrong secret | A broad policy or a role bound to a wildcard namespace or service account grants access to paths meant for other workloads | List every role bound to the namespace, narrow bound service accounts and paths to exact values, and test each workload's token against paths it should not read |
| Injector or CSI volume blocked by Pod Security Standards | The namespace enforces a restricted level that rejects the injected init container, privileged mounts or host paths the component needs | Read the namespace's pod-security labels, check the admission error in pod events, and confirm the required exemption with your platform team before relaxing the level |
Questions buyers ask about OpenBao Kubernetes secrets injection
What drives the cost of OpenBao secrets injection for Kubernetes?
The cost is driven mostly by the number of workloads, namespaces, authentication methods and rotation needs that must be wired up. Each workload needs a service account, a Kubernetes auth role, an OpenBao policy and a delivery configuration, and each application may need changes to read a file or environment variable it did not read before. Cost rises with the number of teams that own workloads, the amount of testing needed in non-production clusters, and any requirement for dynamic credentials instead of static values. DeployOpen does not publish prices. A quote follows from the written scope, so ask for line items per workload group, per cluster and for any application changes, and state which items are one-time and which recur through retainer support.
How long does OpenBao secrets injection take to set up?
Duration depends on how many clusters are involved, how mature the existing OpenBao deployment is, and how many applications need changes to consume injected secrets. A team that already runs OpenBao with Kubernetes auth in place will move faster than one that is still deciding on storage, unseal and high availability. No duration figures are established for this work, so ask for a schedule that lists the clusters, the workload groups in each wave, the test environments used and the cutover approach. Confirm who signs off each stage, since workload owners often control the pace more than the platform work does.
What does our team need to provide before the work starts?
Plan to provide four things: access to the Kubernetes clusters where workloads run, administrative access to the OpenBao cluster so roles, policies and auth methods can be configured, named owners for each workload group who can confirm service accounts and secret paths, and non-production environments where changes can be tested before they reach production. Also confirm who approves changes to pod specifications, since injection alters how pods start. Written access and ownership details belong in the scope so the timeline reflects real availability rather than assumptions.
Can our internal team set up Kubernetes secrets injection without a partner?
Yes, if the team can already manage Kubernetes RBAC and service accounts and can write OpenBao policies and auth roles. The core work is binding each service account to a Kubernetes auth role, limiting that role to the namespaces and policies it needs, and then configuring either the Agent Injector or the CSI provider. The harder parts are usually application changes, testing secret reloads, and keeping policies aligned with workload ownership over time. A partner is most useful when the team lacks capacity for the rollout or wants an independent review of the role model before it grows.
How is secrets injection different from External Secrets Operator?
Injection delivers secrets into a pod at runtime, usually as a file written by a sidecar or mounted through the CSI provider, so the application reads secrets without a native Kubernetes Secret being created. External Secrets Operator instead syncs OpenBao values into native Kubernetes Secrets, which many applications can consume without changes but which then exist in etcd. That storage difference matters, because Kubernetes documentation notes that Secrets are stored unencrypted in etcd by default unless encryption at rest is configured. The right choice depends on whether applications can read files, whether synced Secrets are acceptable in your threat model, and how many clusters need the same values. Compare both before committing, and see the sibling topic on External Secrets Operator for the detailed trade-offs.
Which should we choose: the Agent Injector or the CSI provider?
Choose the Agent Injector when you want a sidecar that authenticates, renders templates and keeps files fresh without changing the mounted volume model, and when your workloads can read files or environment variables from a shared path. Choose the CSI provider when you prefer a mounted volume managed by the kubelet and want fewer sidecars per pod. Both need Kubernetes auth roles per service account, so the identity model is the same either way. Test a representative workload with each method, check how secret rotation reaches the application, and record which method each team uses so operations staff know what to expect during an incident.
What security risks should we check before rolling out injection?
The main risks are overly broad Kubernetes auth roles, where one service account can read secrets belonging to other namespaces, and policies that grant wider paths than the application uses. Also check how pods authenticate to OpenBao, since a leaked or shared service account token can expose the secrets that role allows, and whether files rendered into pods are readable by other containers. Review the Pod Security Standards applied to namespaces that run injected workloads. Ask for a findings list that maps each role and policy to a named owner, and for a retest after fixes, so the rollout is checked against the design rather than assumed to be correct.
How DeployOpen scopes and delivers OpenBao Kubernetes secrets injection
DeployOpen plans and implements OpenBao Kubernetes secrets injection inside your own clusters and networks, starting from a written scope that names the workloads, the injection method and the auth roles involved. Each stage ends with a tested deliverable and documentation your platform and security teams can review and operate after handover.
How we scope
- Inventory the workloads, namespaces and service accounts that need secrets, and which secrets each one reads
- Choose the Agent Injector, the CSI provider or a mix of both, based on your workload types and runtime constraints
- Agree the written scope, deliverables and timeline before any build work starts, since most engagements are fixed-scope
How we build
- Configure Kubernetes auth roles bound to specific service accounts and namespaces, with least-privilege policies per role
- Deploy and configure the chosen injection method in a non-production cluster first, then promote it through your change process
- Test that pods receive only their intended secrets, that rotated secrets reach running workloads, and that denied requests are logged
How we hand over
- Document the role, policy and service account mappings so your team can add a workload without reopening the design
- Deliver runbooks for rotation, auth role changes, troubleshooting and the upgrade steps for both the injector and OpenBao
- Walk your platform and security engineers through the configuration and the test results before the handover is closed
How we support
- Support ongoing operation, upgrades and continuous testing of the injection setup through a retainer
- Retest the setup after Kubernetes or OpenBao upgrades, and after new workloads or auth roles are added
- Keep the evidence your compliance team asks for, such as role inventories and test records, current over time

