Challenge, Easy,  on  Kubernetes

Disable ServiceAccount Token Automounting in a Pod

Scenario

Kubernetes mounts a ServiceAccount token into every Pod by default, but most Pods don't need API server access. Disabling it reduces the attack surface.


Task

Create a Pod in the default namespace that explicitly disables ServiceAccount token automounting.

The Pod should be named pod-no-token, use the httpd:trixie image, and have automountServiceAccountToken set to false. Verify that the token is not present inside the running Pod.


# Verify token is NOT mounted inside the pod
kubectl exec pod-no-token -- ls /var/run/secrets/kubernetes.io/serviceaccount/

Hint 1

To disable token automounting, set automountServiceAccountToken: false directly under spec in your Pod manifest.

See the official docs: Configure Service Accounts for Pods


Test Cases