You need to back up a database running in a container every night with Python and upload to S3. Design it.
AdvancedScenarioKubernetes, Docker, SSH & fleet automation
Answer
Situation read → Scheduled backup, streaming to S3, verified.
What I'd do →
- Run
pg_dump -Fcviasubprocess.Popenand stream stdout straight intos3.upload_fileobj(no local disk needed). - Key by date (
db/2026/11/09/app.dump), SSE-KMS encryption, lifecycle rules for retention. - Check
pg_dump's exit code after the upload; delete the object if the dump failed. - Weekly restore test into a scratch database.
- Run as a Kubernetes CronJob with IRSA/Pod Identity, alert on failure.
Why → Backups that are never restored are hopes, not backups.
Interview tip → Restore testing is what interviewers want to hear.
More on Kubernetes, Docker, SSH & fleet automation
You need a report of every pod in the cluster with no CPU or memory limits. How do you write it?BeginnerYou are asked to write a small operator-like script that adds a label to every new namespace. How do you approach it?AdvancedYou need to restart all Deployments in a namespace that reference a rotated Secret. How?AdvancedYour CI runners keep running out of disk because of Docker images. Write a cleanup plan in Python.IntermediateYou need to run `df -h` on 300 Linux hosts and list any above 85%. Python or Ansible?BeginnerA Python script SSHes to hosts with `AutoAddPolicy`. Security says that is unacceptable. What do you change?Intermediate