More Info:
Advisory: avoid long-lived ServiceAccount token Secrets; use projected (TokenRequest) tokens with an audience and expiry instead.Risk Level
InformationalAddress
SecurityCompliance Standards
- Cloudanix Best Practice
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
On any machine with kubectl access, list all legacy ServiceAccount token Secrets and capture details for review:
-
Identify which applications still rely on these Secrets by searching for references in Pods, Deployments, and other workload specs:
Also inspect any custom manifests/IaC (Helm charts, CD configs, etc.) for explicit mounting of these Secrets.
-
For each workload that currently mounts a ServiceAccount token Secret, decide if you can migrate it to projected ServiceAccount tokens using the EKS-bound token volume instead of a Secret. For Pods you control, plan to:
- Remove
volumes[].secret.secretNameand matchingvolumeMountsthat reference the token Secret. - Use the automatically mounted ServiceAccount token file at
/var/run/secrets/kubernetes.io/serviceaccount/tokenor add a projected serviceAccountToken volume withaudienceandexpirationSecondsif you need custom settings.
- Remove
-
Implement the change for one representative Deployment as a pattern:
In the editor:
- Delete any
volumesentry that usessecret:with the token Secret’s name. - Delete any
volumeMountsthat mount that volume. - (Optional) Add a projected volume, for example:
and mount it via
volumeMountsin the container.
- Delete any
-
After updating all dependent workloads and confirming they run correctly (check logs and readiness), safely remove unused ServiceAccount token Secrets:
-
Verify the cluster no longer relies on long-lived ServiceAccount token Secrets, and that remaining ones (if any) are explicitly justified (for example, for legacy or third-party components you cannot yet change):
Document any remaining Secrets, their owners, and a migration plan to projected tokens where feasible.
Using kubectl
Using kubectl
- Large numbers of
kubernetes.io/service-account-tokenSecrets that are:- Very old (e.g., months/years), and
- Still mounted into Pods or used by external systems.
- Workloads or external clients relying on these Secrets instead of using projected ServiceAccount tokens via the TokenRequest API (audience + short expiry).
Type: kubernetes.io/service-account-token.- No clear operational rotation process; token appears to be a long‑lived credential used by:
- CI/CD systems,
- External scripts/tools,
- Third‑party integrations, etc.
- ServiceAccount token Secrets referenced in ConfigMaps, other Secrets, or annotations as static credentials.
- Evidence the token value has been copied out of the cluster (you’ll usually confirm this via process/doc review, not kubectl).
- Sensitive or externally‑integrated workloads not using
projected.serviceAccountTokenvolumes at all, while still having long‑lived SA token Secrets auto‑created.
.spec.volumes:-
Healthy pattern (what you want to see for security‑sensitive workloads):
-
Problem pattern:
- Only a default SA token Secret volume (legacy behavior), no
projected.serviceAccountToken. - Application docs/manifests instruct users to read
/var/run/secrets/kubernetes.io/serviceaccount/tokenas a de‑facto long‑lived credential.
- Only a default SA token Secret volume (legacy behavior), no
Automation
Automation

