More Info:
Verifies automountServiceAccountToken is false for pods that do not call the Kubernetes API. A mounted token is a ready-made credential for an attacker who lands in the pod.Risk Level
MediumAddress
SecurityCompliance Standards
- Cloudanix Best Practice
Triage and Remediation
- Remediation
Remediation
Manual Steps
Manual Steps
-
Identify noncompliant pods and their owners (run on any machine with kubectl access):
Save the list; for each line note: NAMESPACE, POD_NAME, OWNER_KIND, OWNER_NAME.
-
For each workload, decide if it really needs a service account token (run on any machine with kubectl access):
- Inspect pod spec and image/command:
- Look for:
- In-cluster client libraries (e.g., uses
KUBERNETES_SERVICE_HOST,kubeconfig,client-go,@kubernetes/client-node). - Environment variables, volume mounts, or sidecars that clearly talk to the Kubernetes API.
- In-cluster client libraries (e.g., uses
- If in doubt, consult the application owner; do not disable token automount until you’re confident it does not call the API.
- Inspect pod spec and image/command:
-
For standalone Pods that do not need the API, patch the Pod spec (run on any machine with kubectl access):
Note: If the Pod is controlled by a higher-level object (Deployment, DaemonSet, etc.), this change will be lost when the controller recreates the Pod; in that case, change the controller instead (next step).
-
For controller-managed workloads that do not need the API, patch the controller spec (run on any machine with kubectl access, pick the right kind per workload):
Deployment example:
DaemonSet example:StatefulSet example:Job example:CronJob example:
-
(Optional) If multiple pods in a namespace share a ServiceAccount and none of their workloads call the API, you may set it once at the ServiceAccount level instead (run on any machine with kubectl access, and only after confirming no user of the ServiceAccount needs the API):
Then ensure any workload that does need the token either uses a different ServiceAccount or explicitly sets
automountServiceAccountToken: truein its pod template. -
Verify remediation (run on any machine with kubectl access):
Using kubectl
Using kubectl
On any machine with kubectl access:For each non‑system pod reported as noncompliant, determine its controller (Deployment, StatefulSet, etc.):Do not edit bare Pods that are managed by a controller; changes will be overwritten. Always patch the controller.StatefulSetDaemonSetIf the workload legitimately calls the Kubernetes API, review and skip patching instead of forcing this setting.
- Identify the pod and owning controller
- Patch the controller template to disable token automount
ownerReferences.kind you saw):Deployment- Optional: set it on the ServiceAccount instead of each pod
- Verification
Automation
Automation

