More Info:
Default service accounts should not be granted permissions or actively used by workloads. Create explicit service accounts and disable token automounting on default accounts.Risk Level
MediumAddress
SecurityCompliance Standards
- CIS OKE
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
From any machine with kubectl access, list all namespaces and identify which have a
defaultservice account using tokens: -
For each namespace, identify workloads that are implicitly or explicitly using the
defaultservice account:Review pods that show an emptyserviceAccountName(implicitly default) orserviceAccountName: defaultto determine whether they truly need API access. -
For pods using the default service account, inspect their specs for explicit token mounting or inherited defaults:
Decide whether each workload needs Kubernetes API access and, if so, what minimum permissions it needs.
-
Where workloads require API access, design explicit, least-privilege service accounts and RBAC:
Update the corresponding Deployment/StatefulSet/Job manifests to set
spec.template.spec.serviceAccountName: <sa-name>and, if needed,automountServiceAccountToken: truethere instead of relying on defaults. -
After migrating workloads off the default service account in a namespace, disable token automount on that default account:
If using GitOps/manifests, ensure the same setting is defined in the ServiceAccount manifest rather than patching only live state.
-
Verify that:
- No workloads are using the
defaultservice account except where consciously accepted, and - All default service accounts have token automount disabled:
- No workloads are using the
Using kubectl
Using kubectl
- Every namespace will have a
defaultServiceAccount; that alone is not an issue. - Note any namespaces where workloads exist and you expect them to use dedicated service accounts instead of
default.
automountServiceAccountToken: true(explicit) on a default ServiceAccount is a concern.- Missing
automountServiceAccountTokenmeans it inherits from pod spec / cluster defaults; treat as needing review. - Tokens listed under
secrets:confirm token creation, but not necessarily active use.
- Any pod where the third column is
defaultis actively using the default ServiceAccount. - Focus on namespaces with sensitive workloads or where API access should be tightly scoped.
truemeans the pod is set to mount a token.nullmeans it may inherit from the ServiceAccount (or cluster default); requires manual review of both pod and SA.
jq is not available, inspect specific pods:spec.serviceAccountName: defaultANDspec.automountServiceAccountToken: true(or absent when SA/cluster default is true) AND- A projected service account token volume in
spec.volumesor a token under/var/run/secrets/kubernetes.io/serviceaccount.
- Any
RoleBindingorClusterRoleBindingwhosesubjectsinclude:kind: ServiceAccountname: default- plus a
namespace:value
- Especially concerning if bound to powerful
Role/ClusterRole(e.g.,cluster-admin, broad*verbs/resources).
- Any line returned indicates a default ServiceAccount is granted explicit RBAC permissions.
- The more privileged the referenced
Role/ClusterRole, the higher the concern.
- Where new, explicit ServiceAccounts should be created.
- Where to stop using
defaultin pod specs. - Where
automountServiceAccountToken: falseshould be set on default ServiceAccounts and/or pods.
Automation
Automation

