More Info:
Assign each pod a dedicated service account instead of relying on the default service account, so that permissions can be scoped per workload.Risk Level
MediumAddress
SecurityCompliance Standards
- CIS OKE
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
List all workloads and their service accounts
- Run on: any machine with
kubectlaccess - Command (per namespace; start with production namespaces):
- Identify pods where
SAis empty ordefault, especially for internet-facing, privileged, or data-sensitive workloads.
- Run on: any machine with
-
Review namespace-level usage of the default service account
- Run on: any machine with
kubectlaccess - Commands:
- Decide per namespace whether the
defaultservice account is (a) unused and should stay unprivileged, or (b) used by many workloads and should be replaced with per-workload service accounts.
- Run on: any machine with
-
Design dedicated service accounts and permissions (IaC / control-plane configuration)
- In your cloud/IaC configuration (e.g., Helm values, Terraform, CD pipeline manifests, or cloud console workload configuration screens), for each application:
- Define a dedicated
ServiceAccountobject name (e.g.,orders-api-sa). - Bind that service account only to the minimal
Role/ClusterRoleneeded.
- Define a dedicated
- Example manifest snippet to model in IaC (do not apply with
kubectlif you manage via IaC):
- In your cloud/IaC configuration (e.g., Helm values, Terraform, CD pipeline manifests, or cloud console workload configuration screens), for each application:
-
Update workload definitions to use dedicated service accounts
- In your cloud provider console, CLI, or IaC for each deployment/statefulset/cronjob:
- Set
spec.template.spec.serviceAccountNameto the dedicated service account.
- Set
- Example pod template snippet for IaC/console:
- Redeploy workloads via your normal CI/CD or cloud provider deployment mechanism.
- In your cloud provider console, CLI, or IaC for each deployment/statefulset/cronjob:
-
Optionally restrict the default service account
- In namespaces where dedicated service accounts are now used for all meaningful workloads:
- Ensure the
defaultservice account has no elevatedRoleBinding/ClusterRoleBinding. Remove or adjust bindings in IaC/cloud console where they referencedefault.
- Ensure the
- If your provider supports toggling “automount service account token” at namespace or service account level, disable it for
defaultwhere practical.
- In namespaces where dedicated service accounts are now used for all meaningful workloads:
-
Verify that dedicated service accounts are in use
- Run on: any machine with
kubectlaccess - Commands:
Confirm that all non-trivial workloads show a specific, non-
defaultservice account. For a spot check, inspect a pod’s full spec:
- Run on: any machine with
Using kubectl
Using kubectl
kubectl cannot remediate this finding because it concerns how workloads are defined and deployed in your cloud provider / IaC configuration, not a one-off API change. Make the changes in your cloud console, CI/CD pipeline, or IaC templates to assign explicit, non-default service accounts to pods, and follow the guidance in the Manual Steps section to review and update those definitions.
Automation
Automation
- Any line in the first table shows a pod currently using the
defaultservice account in its namespace. - Namespaces with a non-zero
pods_using_default_sacount in the summary need review. - For each such pod, decide (manually) whether:
- It is acceptable for it to use the namespace’s
defaultservice account with its current RBAC, or - You should create and assign a dedicated, least-privilege service account via your cloud/IaC configuration.
- It is acceptable for it to use the namespace’s

