Give each workload its own identity
- 12 min
- 6 steps
- Security
Steps
0 of 6 done
Repair a Deployment that names a missing ServiceAccount, read the token the kubelet projects, and take API credentials away from pods that never call the API.
Step 1 of 6
The
auditDeployment inshophas no pods at all, not even failing ones. Find the message the ReplicaSet controller records each time it tries to create one.Checked against what your commands print.
Step 2, not started: Give
auditthe identity its pod template asks for, without changing the Deployment.Step 3, not started: The
storefrontpod template names no ServiceAccount, yet each pod carries an API token. From a running storefront pod's spec, find how many seconds the kubelet asks the API server to make that token valid for.Step 4, not started:
storefrontserves pages and never calls the Kubernetes API. Give it its own ServiceAccount, namedstorefront, that does not mount a token into pods by default, and move the Deployment onto it.Step 5, not started: Confirm that the replacement storefront pods have no token volume and nothing mounted at
/var/run/secrets/kubernetes.io/serviceaccount.Step 6, not started:
auditdoes not call the API either, but other workloads will share theauditorServiceAccount later and some of them will. Stop token mounting foraudit's pods only, and leave the ServiceAccount as it is.
Enter runs the command. Tab completes, and the arrow keys recall earlier commands. Control C stops a watch. On an empty line, or after Escape, Tab moves focus out of the terminal.