More Info:
Default service accounts should not be actively used by workloads and should have token automounting disabled. Use explicit service accounts scoped to each workloads needs.Risk Level
MediumAddress
SecurityCompliance Standards
- CIS EKS
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
Identify all default service accounts and namespaces
Run on: any machine with kubectl access -
Disable token automount on every default service account
Run on: any machine with kubectl access
(Run once per namespace;default,kube-system, and any others in use.) -
List pods currently using the default service account
Run on: any machine with kubectl access -
Create explicit service accounts for workloads that need API access
Run on: any machine with kubectl access
(Example for one namespace; repeat as needed, adjusting names and namespaces.) -
Update workloads to use the explicit service accounts and (optionally) disable pod-level automount
Run on: any machine with kubectl access
Edit each deployment/statefulset/cronjob/etc. that currently usesserviceAccountName: default:In.spec.template.spec: -
Verification
Run on: any machine with kubectl access
Using kubectl
Using kubectl
On any machine with kubectl access:Apply:
- Disable token automounting on all existing
defaultServiceAccounts
- For workloads that need API access, create explicit ServiceAccounts and use them in Pod specs
sa-and-deployment.yaml and apply):-
Optionally, prevent default use in new workloads by setting an explicit ServiceAccount in your own pod/deployment manifests and avoiding
serviceAccountName: default. - Verification
Automation
Automation

