Why a stolen pod token matters and how to shrink its reach
A platform team in a regulated organization often finds that many of its pods carry API credentials they never use. A service account token is the identity a pod presents to the Kubernetes API server, and whoever holds that token can make the same API calls the pod could. If an application is compromised, the attacker inherits whatever the pod's service account is allowed to do, which may be far more than the application needs. The cluster's own authentication model is what makes this matter: Kubernetes does not represent ordinary workloads as user objects, and the API server validates bearer tokens presented by service accounts in the same way it validates other bearer credentials. The reach of a stolen token is therefore set by two things you control: how long the token lives and what the bound service account can do through RBAC.
This page covers four levers that reduce that reach. Bound, short-lived tokens replace the long-lived Secrets that older clusters created automatically, so a leaked credential expires instead of working indefinitely. Disabling automount, which places the token into the pod filesystem by default, removes the credential from workloads that never call the API. Cleaning up legacy token Secrets removes copies that still exist in etcd and in backups. Least-privilege roles bound to each service account limit what remains. Each lever is a configuration decision with side effects for controllers, operators and monitoring agents, so inventory which workloads actually call the API before changing defaults. Confirm your cluster version and the token behavior it ships with against the Kubernetes documentation before you plan the rollout.
Plan this work before an audit asks how service account credentials are scoped, after any container compromise where the attacker may have read a mounted token, and whenever workload counts grow faster than the review of their permissions. Ask your team to answer three questions for each namespace: which service accounts have bindings, which pods mount tokens they do not use, and which Secrets of type service account token still exist. Those answers set the scope of a fixed-scope engagement and the effort it needs. Treat the output as a working inventory, not a one-time report, because new deployments will reintroduce default behavior unless admission rules or review gates catch it.
Which token approach fits each workload
Many application pods never talk to the Kubernetes API at all. For these, the safest setting is to stop Kubernetes from mounting a token into the pod in the first place. A token that is never mounted cannot be stolen from the container filesystem, and a compromised process has nothing to present to the API server. The trade-off is that some workloads, including certain controllers, sidecars and operators bundled in charts, do read the token by default, so disabling it can break them in ways that only appear after rollout.
- Set automount off at the service account: Use
automountServiceAccountToken: falseon the ServiceAccount, which covers every pod that uses it. - Repeat it at the pod level when needed: A pod-level setting can override the service account, so review both fields in manifests and Helm values.
- Use a dedicated service account: Avoid the namespace
defaultservice account for workloads, so that a change does not affect unrelated pods. - Check chart defaults: Many third-party charts create service accounts and mount tokens unless their values are changed.
- Test before rollout: Confirm the application starts and serves traffic with no token present.
Before changing anything, search the pod logs and manifests for calls to the API and confirm with the application owner that none are needed.
Some workloads need the API, for example to read ConfigMaps, watch their own custom resources or leader-elect. For these pods, keep the automounted token but bind it to a Role that grants only the verbs and resources the workload uses. The token is still a credential, so its value depends on how narrow the binding is. The trade-off is effort: each service account needs its own role, and roles drift as applications change, so they need periodic review.
- Create one service account per workload: Bind roles to that account rather than to groups or to
default. - Grant namespaced Roles first: Use ClusterRoles only for resources that are genuinely cluster-scoped, and bind them with a RoleBinding where possible.
- Limit verbs and resource names: Name specific objects with
resourceNameswhere the API supports it, and avoid wildcards on verbs or resources. - Remove secret read access: Listing or getting Secrets through a service account gives access to every Secret it can see in scope, so confirm this is required.
- Verify permissions: Use
kubectl auth can-i --aswith the service account to check what it can actually do.
Before finalizing, list every API call the workload makes and confirm that each one maps to a rule in its role.
When a pod calls an external service, such as a cloud API, a vault or an internal gateway, it can present a projected service account token whose audience is set to that service. Bound tokens are time-limited and tied to the pod, so they expire and cannot be reused against unrelated services. The receiving service must validate the audience claim, and that check is the part teams most often skip. The trade-off is that token refresh is handled by the kubelet and the target service must accept Kubernetes-issued tokens, which varies by product.
- Use a projected volume: Mount a
serviceAccountTokensource with an explicitaudienceand a shortexpirationSeconds. - Keep the audience specific: Set it to the single service that will accept the token, not a generic value.
- Configure the receiver: Confirm the external service checks the audience, issuer and expiry before trusting the token.
- Disable default mounts for this pod: Pair the projected token with automount off so that only the intended token is present.
- Confirm refresh behavior: Check that the application reloads the token file when it changes, because long-running clients can keep using an old value.
Before rollout, ask the external service owner whether it accepts bound service account tokens and which audience value it expects.
Older clusters and tooling created Secrets of type kubernetes.io/service-account-token that hold a token with no expiry. These tokens remain valid until the Secret is deleted, and anyone who can read the Secret can use the token. Newer Kubernetes releases no longer create these automatically for new service accounts, but existing Secrets stay where they are unless someone removes them. The trade-off is that deleting a token Secret can break a workload or pipeline that still reads it, so the cleanup needs an inventory first.
- Inventory token Secrets: List Secrets of this type in every namespace and match each one to the workload that reads it.
- Move workloads to projected tokens: Update the application or pipeline to use a bound token or an external identity before removing the old Secret.
- Delete unused Secrets: Remove the Secret after confirming no workload references it, and rotate any credential it may have exposed.
- Review who can read Secrets: Restrict list and get access, since reading one of these Secrets yields a usable credential.
- Check external copies: Tokens copied into CI systems or configuration repositories need the same cleanup.
Before deleting anything, confirm with the owner of each workload when its token is last used and whether a replacement is in place.
Configuration options and when each one fits
This table compares the four Kubernetes mechanisms that shape what a pod's service account token can do and where it is exposed. Read each row as a separate control, since most clusters combine several of them. The main takeaway is that disabling automount and binding tokens to short lifetimes and specific audiences removes most of the standing exposure, while RBAC decides what any remaining token can reach.
| Option | What it limits | When it fits | What to confirm |
|---|---|---|---|
| automountServiceAccountToken on the service account | Stops the token from being mounted into every pod that uses the account, so pods must opt in to API access. | Service accounts used by workloads that never call the Kubernetes API, such as most stateless web services and batch jobs. | Which existing workloads read the token from their mounted path, and whether any Helm charts or operators depend on automount. |
| automountServiceAccountToken on the pod spec | Overrides the service account setting for one pod, in either direction. | Exceptions where one pod in a namespace needs API access, or where a shared service account must stay unmounted for most pods. | That the pod-level value wins in your cluster version, and that admission policy checks the pod field, not only the account. |
| Projected bound service account token volume | Issues a short-lived token bound to a named audience and expiration, and tied to the pod's lifetime, instead of a static credential. | Workloads that must authenticate to the API server or to an external service that accepts Kubernetes tokens, such as a secrets or identity system. | The audience values each receiving service expects, the expiration the application can tolerate through rotation, and whether the app reloads the file. |
| Dedicated long-lived token Secret of type service-account-token | Creates a static token that does not expire and is not bound to a pod, which widens the blast radius if it leaks. | Rarely justified. Consider it only for external systems that cannot read projected tokens and have no other supported option. | Which Secrets of this type exist in each namespace, who can read them, and whether any external system still depends on them before removal. |
| RBAC role bindings per service account | Defines what the token may do after it is presented, through Roles and RoleBindings scoped to namespaces or specific resources. | Every workload that keeps API access, including operators and controllers that need to watch or patch objects. | That no binding uses cluster-wide scope or wildcard verbs, and that default service accounts have no bindings the application does not need. |
Setup sequence for tightening service account tokens
This sequence shrinks what a stolen pod token can reach by finding every token consumer, cutting off tokens that are not needed, moving the rest to short-lived bound tokens and scoping each service account to the calls it actually makes. The result is a cluster where each workload has a documented, tested API footprint.
Inventory token mounts and API callers
List every pod, deployment, and service account in the cluster, and record which ones mount a token into their containers. Then check audit logs or request history to see which service accounts actually call the API server and which verbs they use. Keep the inventory in version control so reviewers can compare it later. The step is done when every workload is classified as either calling the API or not calling it, with the owning team named for each.
Identify legacy token Secrets
Find Secrets of type kubernetes.io/service-account-token, which hold long-lived tokens created by older Kubernetes behavior or by manual setup. Record which service account each one belongs to and whether any workload or external system still reads it. Confirm this with the owning team before removing anything, because some CI jobs and external tools depend on these Secrets. The step is done when you have a list of legacy token Secrets and a known consumer, or a confirmed lack of one, for each.
Disable automount for workloads without API needs
Set automountServiceAccountToken to false on the service account or pod spec for workloads that never call the Kubernetes API. Apply the change in a test namespace first, then roll it out through the normal change process. Verify that the pod no longer has a token file under /var/run/secrets/kubernetes.io/serviceaccount and that the application still starts and works. The step is done when those workloads run cleanly with no mounted token.
Adopt projected bound tokens for remaining workloads
For workloads that do call the API, make sure they use projected service account tokens with a bound audience and an expiration, which the kubelet rotates automatically. Update client libraries and in-cluster configs that read the token file so they reload it rather than caching it at startup. Confirm the client behaves correctly after rotation by checking logs over a rotation cycle. The step is done when every API-calling pod uses a bound token and no pod depends on a static token Secret.
Remove unused token Secrets
Delete the legacy token Secrets confirmed as unused in the earlier steps, and remove the service account references that point to them. Keep a record of each deleted Secret name and the date of removal, along with the change ticket. Watch application and pipeline logs for authentication failures for a period agreed with the owning teams, and restore a Secret only through a documented exception. The step is done when no unused long-lived token Secrets remain and the change record is complete.
Write per-service-account roles
Create a dedicated service account for each workload that calls the API, and bind it to a Role or ClusterRole that grants only the verbs and resources seen in the inventory. Avoid binding the default service account and avoid wildcard verbs or resources unless a reviewer approves them in writing. Store the roles and bindings in Git so changes go through review. The step is done when each API-calling workload maps to one service account with a short, reviewed permission list.
Test that out-of-scope calls are denied
Run a test pod using each service account and attempt calls that the role should not allow, such as listing Secrets in other namespaces or creating pods. You can also use kubectl auth can-i with the --as flag for a quick check of permissions. Record the expected and actual result for each attempt, and keep the test in a pipeline so it runs again after changes. The step is done when every out-of-scope call returns a forbidden response and every in-scope call succeeds.
Confirm the sequence in a periodic review
Schedule a recurring review of service accounts, token mounts, and role bindings, and compare the results with the inventory from the first step. Ask teams to explain any new automount setting, new legacy Secret, or broad role before it reaches production. Ask your auditors or compliance lead which evidence they will want, such as the inventory, change records, and test results. The step is done when the review has a named owner and a documented cadence agreed with the platform team.
How a pod token flows from the kubelet to the API server
The path starts when the kubelet starts a pod that references a service account, and it projects a bound, short-lived token into the pod as a file. When the workload calls kube-apiserver, the server first authenticates the token, then checks the service account's RBAC bindings during authorization. The trust boundary sits between the container and the control plane, so the checks to make are whether automount is disabled where API access is not needed and whether each service account's roles grant only what it uses.
Token projection, API authentication and RBAC authorization across the pod to control plane boundary.
Security and operational risks to manage
Service account tokens are credentials that travel with every pod that mounts them. The risks below share one root cause: a token grants whatever its service account is bound to, for as long as the token or its Secret exists, and nothing in a default cluster narrows that by itself.
Over-broad bindings on the default service account
Every namespace has a default service account, and pods that do not name another account run under it. If a cluster administrator or a chart has bound roles to that account, every workload in the namespace inherits those permissions. Check which RoleBindings and ClusterRoleBindings reference default, and remove any grant that a pod in that namespace does not clearly need. Dedicated service accounts per workload make the blast radius of a stolen token easier to explain to reviewers.
Long-lived token Secrets readable by list or watch
Older clusters and some manifests still create Secrets of type kubernetes.io/service-account-token, which hold a token that does not expire. Secrets are stored unencrypted in etcd unless encryption at rest is configured, and anyone with list or watch access to Secrets in a namespace can read every token in it. Inventory these Secrets, confirm which workloads still use them, and restrict list and watch verbs in RBAC to the few identities that need them.
Tokens mounted into pods that never call the API
By default, the API token is projected into every pod, even pods that only serve HTTP or run batch jobs and never talk to the Kubernetes API. Those tokens add exposure without adding function. Identify workloads that do not call the API and set automountServiceAccountToken to false on the pod spec or the service account. Test each change, because a controller, operator or sidecar that does need the API will fail once its token is removed.
Token audience misuse
Projected service account tokens can be issued with a specific audience, so a token meant for the API server or for an external verifier cannot be replayed against an unrelated service that accepts any Kubernetes-issued token. Where a workload needs to authenticate to another system, confirm the audience it requests and the verifier's expectations. Ask each application owner which audiences their code accepts, and reject tokens that do not match.
Drift when new charts add automount
Helm charts and operators often ship their own service accounts, role bindings and pod specs, and their defaults may change between versions. A chart upgrade can quietly re-enable automounting or add a binding that the platform team never reviewed. Render charts to manifests in CI, check the rendered output for automountServiceAccountToken and new RoleBindings, and enforce the expected setting with a policy engine so that drift is blocked or reported.
Audit visibility of token use
A token that is misused will only leave a trail if the API server audit policy records the relevant requests. Confirm that audit logging covers authentication decisions and access to Secrets and token requests, and that logs are retained and searchable by service account name. Without that record, a team cannot tell which token made a suspicious call or how far it reached. Verify the audit policy in a test cluster before relying on it for an investigation.
Questions teams ask before changing service account tokens
How much effort does tightening service account tokens take?
The effort depends mostly on how many workloads, Helm charts and third-party operators use the API, and on how many of them depend on mounted tokens. A cluster where most pods never call the Kubernetes API is far quicker to change than one where controllers, CI jobs and monitoring agents all read the API from inside pods. The work splits into four parts: inventory which pods need API access, disable automount where it is not needed, move legacy token Secrets to bound short-lived tokens, and write least-privilege roles per service account. Ask any partner to size the work from a written inventory of your workloads rather than from the cluster name or node count.
Can our platform team make these changes on its own?
Often yes, if the team already runs the cluster, understands RBAC and can read application manifests. The hard part is rarely the YAML. It is knowing which service accounts a third-party chart or operator needs, and confirming that a change will not stop a controller that quietly reads its own token. Teams without that context, or without owners for each application, usually bring in outside help for the inventory and the review of charts they did not write. Whether to do it alone is a question about your team's capacity and familiarity with the applications, and a written scope makes that trade-off visible before work starts.
What do we need to provide before the work starts?
Plan to provide four things: a list of namespaces, workloads and Helm releases running in the cluster, the Kubernetes version and how the cluster was installed, named owners for each application who can confirm its API calls, and agreed change windows for restarts. The owners matter most. A platform engineer can see that a pod mounts a token, but only the application owner can say whether the application uses it. Ask whether the engagement includes building this inventory or whether your team must deliver it first, because that decision changes both the timeline and the cost.
How do we roll out token changes without breaking pods?
Roll out in stages: start with workloads that do not call the API, then move to workloads that do, one namespace at a time. For each service account, confirm the required permissions in a non-production cluster, set automount to false only after confirming no API call is needed, and check pod logs for authorization errors after each restart. Keep the legacy token Secrets in place until every consumer has moved to projected, bound tokens, then remove them. Record a rollback step for each namespace, such as re-enabling automount on the pod spec. Many breakages appear only in scheduled jobs or rarely used code paths, so keep the rollout window long enough to observe them.
Which cost components should a quote for this work include?
A quote usually separates a discovery and inventory phase, the configuration changes themselves, testing in a non-production environment, production rollout with change windows, and documentation for the platform team. Ask whether the price covers a review of third-party charts and operators, and whether retesting after cluster upgrades is included. Some costs recur, such as reviewing new workloads as they are added and re-checking RBAC when charts are upgraded, so ask whether that is a separate retainer. DeployOpen does not publish a price list; a quote follows from the written scope, which should name each component above.
Does a bound token change protect us from every token theft?
No. Bound, short-lived tokens limit how long a stolen token stays useful and tie it to a specific pod, but they do not stop an attacker who can already run code in a pod with a broad role. Least-privilege roles per service account limit what the token can do, and disabling automount removes the token entirely from pods that never need it. Treat these as layers that reduce blast radius, alongside network policy, Pod Security Admission and encryption of Secrets at rest. Confirm the exact token behavior for your Kubernetes version in the official authentication documentation before you write policy around it.
What should we confirm with our vendors before changing tokens?
Ask each chart and operator vendor whether it reads the Kubernetes API from inside the pod, which service account and roles it requires, and whether it supports projected service account tokens. Some vendors document these requirements clearly, and others do not, so the answer may need to come from testing. Also confirm your supported Kubernetes version, since token behavior has changed across releases. Check the release status on the official Kubernetes releases page so your changes fit a version that is still receiving patches.
Limits to confirm in your environment
Token hardening changes what workloads can reach, so the same change can be safe in one cluster and break another. The cards below list the points to test in your own environment before you roll out bound tokens, disabled automount or narrower roles.
Third-party charts and operators
Many charts and operators need to call the API server to watch resources, leader elect or manage custom objects. Their service accounts may depend on automounted tokens, and disabling automount can stop them from starting or reconciling. Check each chart's values for automount settings and list the API verbs its service account uses in audit logs before you restrict it. Treat every operator as a separate test case, because vendors document this behavior unevenly.
Managed cluster provider settings
Managed control planes may set defaults, admission behavior or token issuer configuration that differ from upstream kubeadm clusters. Confirm with your provider whether legacy token Secrets are created automatically, which issuer and audience values are used for projected tokens, and whether you can change the default automount behavior. Record the answers, since they determine which parts of this plan apply to you.
Application compatibility with rotated tokens
Projected service account tokens expire and are refreshed by the kubelet, and the file on disk changes over time. Some applications read the token once at startup and keep using it, and their client libraries may not reload the file. Test each application in a staging cluster with a token lifetime short enough to expose the problem, and confirm that it recovers after rotation without a restart.
Network policy interactions
Restricting token use does not replace network controls, and network policies can change how a workload reaches the API server. Confirm that the policies you already run still allow the workloads that need API access, and that the API server endpoint is reachable from the namespaces where it is required. Test both directions, because a policy that blocks API traffic can look like a token failure during troubleshooting.
Behavior in your cluster version
Token behavior, default flags and deprecation timing change between minor releases, so guidance written for one version may not match the version you run. Read the release notes for your exact version and the ones between it and your target before you change defaults. Check whether legacy token Secret handling or bound token claims differ in your release, and test the change on a cluster running that version.
Kubernetes releasesHow DeployOpen works on this
DeployOpen scopes service account token hardening from an inventory of which workloads call the Kubernetes API and with which permissions. The work is then built, tested and documented inside your own clusters, so your team can review and operate the result.
How we scope
- Inventory every namespace, service account and workload that mounts a token or calls the API server.
- Classify each workload by the API verbs and resources it truly needs before changing any setting.
- Agree the scope, deliverables and timeline in writing before work starts, as engagements are fixed-scope.
How we build
- Set automount to false on service accounts and pods that never call the Kubernetes API.
- Move remaining workloads to bound, short-lived projected tokens and rewrite least-privilege Roles and RoleBindings per service account.
- Test each change in a non-production cluster, then roll it out namespace by namespace with rollback steps ready.
How we hand over
- Remove legacy long-lived token Secrets only after confirming no workload still reads them, and document the cleanup steps.
- Deliver a written record of every service account, its permissions, its token behavior and the reason for each exception.
- Walk your platform and security engineers through the audit checks they need to repeat when new workloads are added.
How we support
- Ongoing support, upgrades and continuous testing are available as a retainer after handover.
- Review new workloads and Helm charts against the service account and RBAC standards agreed in the scope.
- Re-check token behavior when you upgrade Kubernetes, since defaults and API versions change between minor releases.

