Mount a Secret, audit who can read it, rotate it
- 12 min
- 7 steps
- Config, storage and state
Steps
0 of 7 done
Give a Deployment the Secret it mounts, find the RBAC path that reads it without any rule on secrets, and rotate the value in place.
Step 1 of 7
The
ledgerpods inpaymentsnever get pastContainerCreating. Find the event that names what they are waiting for.Checked against what your commands print.
Step 2, not started: Create the generic Secret
ledger-apiinpaymentswith one key,api-token, set totok-7f3a9c. Wait for both pods to become ready.Step 3, not started: Read the token the way the application does: as a file under the volume's mount path inside a running
ledgerpod.Step 4, not started: The team is moving
ledgerto a private registry. Create a Secretghcr-pullinpaymentsof the type the kubelet reads for registry credentials, for serverghcr.io, userledger-ciand passwordexample-token.Step 5, not started: The
ci-deployerservice account's Role has no rule onsecrets. Ask the API server whether that service account can do the thing that lets it readledger-apianyway.Step 6, not started: Rotate the token in place: set
api-tokeninledger-apitotok-81d2e4without deleting the Secret.Step 7, not started: Confirm that the running pods see the rotated token in the mounted file, with no restart. On a real cluster this can take a minute or more after the patch.
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.