⚡ ~/naveed Interview Prep
⚡ Portfolio Home 👤 About Naveed Bio & Credentials 📫 Contact Naveed Get In Touch ✍️ Engineering Blog Deep Dives 🎯 Interview Hub 1,000+ Scenarios ☸️ Kubernetes Mastery Hub 24 Modules 🎮 DevOps Arcade & Quizzes Subnet Blitz ⚡ 🗺️ DevOps Roadmaps PDFs & Guides 🤖 Morpheus Analysis AI Quant ↗ 🛠️ Developer Tools Utilities 🧪 Labs & Experiments 📄 Interactive CV & Certs 🔗 All Links & Socials ⚡ Join The Dispatch (Weekly SRE Newsletter) →
← Back to All Databases & Storage Interview Questions Scenario 14 of 54 in Databases & Storage
Senior DevOps / SRE [L2] Database Deployments & Workloads Production Scenario [L2]
🎯 Target Role / Context: Kubernetes Scenario #12 (L2) · Deployments & Workloads

Q: You need to run a database in Kubernetes. Someone says just use a Deployment with a PVC. Is that okay?

Not ideal. A Deployment doesn't guarantee stable pod identity or ordered startup/shutdown, which matters for clustered databases (Postgres HA, MySQL replication, Cassandra).

#Kubernetes #Deployments & Workloads #L2 #Container Orchestration #K8s #Terraform State
🎙️ Candidate Opening & Architectural Context
""Kubernetes is a declarative desired state system; understanding the reconciliation loop is how you diagnose this quickly. The interviewer is testing: StatefulSet necessity understanding.. I structure my answer around systematic triage first, root cause analysis second, and permanent remediation third.""
Advertisement
⚡ Recommended Practice Lab

Want to master this scenario in a live sandbox? KodeKloud's PostgreSQL Database Administration & High Availability Course covers this exact problem with hands-on terminal drills.

🛠️ Production Runbook & Step-by-Step Resolution

Direct Answer: "Kubernetes is a declarative desired state system; understanding the reconciliation loop is how you diagnose this quickly. The interviewer is testing: StatefulSet necessity understanding.. I structure my answer around systematic triage first, root cause analysis second, and permanent remediation third."

1️⃣

Initial Diagnostics & Root Cause Analysis

Not ideal. A Deployment doesn't guarantee stable pod identity or ordered startup/shutdown, which matters for clustered databases (Postgres HA, MySQL replication, Cassandra). Also, if a Deployment has multiple replicas, all pods might try to bind the same PVC — which only one can do (unless using ReadWriteMany).

  • Each replica gets its own PVC via volumeClaimTemplates.
  • Pods get stable DNS names (e.g., mysql-0.mysql, mysql-1.mysql) needed for replication setup.
  • Ordered startup ensures primary starts before replicas.
2️⃣

Remediation & Permanent Safeguards

StatefulSet is the right choice because: For a single-instance DB with no replication, a Deployment + PVC works fine but is still a corner case.

💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Pro-Tip: Each replica gets its own PVC via volumeClaimTemplates.."
⚡ 60-Second Elevator Pitch Talking Points
  • Each replica gets its own PVC via volumeClaimTemplates.
  • Pods get stable DNS names (e.g., mysql-0.mysql, mysql-1.mysql) needed for replication setup.
  • Ordered startup ensures primary starts before replicas.
⛔ Critical Candidate Mistakes to Avoid in This Scenario

Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:

  1. Applying exclusive-lock DDL table migrations on live production databases during peak traffic windows when configuring need database Kubernetes DDL migrations that acquire an exclusive table lock block all concurrent queries, queuing connections until the database connection pool exhausts.
  2. Allowing high-frequency queries to trigger full table scans without appropriate composite indexing when configuring need database Kubernetes Sequential table scans saturate database CPU and disk I/O, evicting frequently queried data from the buffer cache and causing cascading timeouts.
  3. Disabling referential integrity constraints during bulk ETL imports without post-import consistency validation when configuring need database Kubernetes Skipping relational consistency checks risks introducing orphaned records and referential integrity violations into production tables.
  4. Relying on database snapshot backups that have never been verified through automated restoration drills when configuring need database Kubernetes Backups that have never been tested with automated restore verification frequently fail during real disaster recovery scenarios.
Advertisement
Want more Databases & Storage scenarios?
Explore our complete collection of scenario-based Databases & Storage interview runbooks.
Browse All Databases & Storage Questions →