You need to rotate a credential stored in 12 places (Secrets Manager, two Kubernetes secrets, a Jenkins credential and a config file). How would you automate it?
AdvancedScenarioAutomation scripting & CLI design
Answer
Situation read → Multi-system change; a half-finished rotation is an outage.
What I'd do →
- Reduce the 12 places to 1: Secrets Manager as source of truth, with External Secrets Operator syncing into Kubernetes and Jenkins reading from it.
- Script the rotation as phases: create new credential (both valid), update the source of truth, wait for consumers to pick it up (verify via health checks), revoke the old one.
- Make each step idempotent and log state so a rerun continues from where it stopped.
- Prefer Secrets Manager's built-in rotation Lambda for supported databases.
Why → The dual-validity window is what makes rotation zero-downtime.
Interview tip → Say you would fix the sprawl first; automating 12 copies is automating the problem.
More on Automation scripting & CLI design
Your team has a 300-line Bash script that parses JSON with `jq`, loops over AWS accounts and retries with `sleep`. It breaks every month. Do you rewrite it in Python?BeginnerA colleague's script deletes files older than 30 days from `/var/log/app`. You are asked to review it before it goes into cron. What do you look for?IntermediateYou need a script that ops engineers run from laptops and that CI runs nightly. How do you design its interface?IntermediateA script reads a 15 GB access log to count 5xx errors per endpoint, and the box runs out of memory. How do you fix it?BeginnerYou must run the same Python automation on 40 servers that have Python 3.6, 3.9 and 3.12. What do you do?IntermediateA cron job that runs a Python script fails silently. Nobody noticed for two weeks. How do you make sure that never happens again?Intermediate