Q: Your CronJob is creating overlapping runs — the previous job hasn't finished when the next one starts. How do you fix it?
Set concurrencyPolicy: Forbid in the CronJob spec. This skips the new run if the previous one is still running.
#Kubernetes #Deployments & Workloads #L2 #Container Orchestration #K8s
🎙️ Candidate Opening & Architectural Context
""Kubernetes is a declarative desired state system; understanding the reconciliation loop is how you diagnose this quickly. When addressing this question, I walk the interviewer through our production incident runbook: isolating the blast radius, checking diagnostic logs and metrics, and applying a safe fix.""
Advertisement
🛠️ Production Runbook & Step-by-Step Resolution
1️⃣
Initial Diagnostics & Root Cause Analysis
Set concurrencyPolicy: Forbid in the CronJob spec. This skips the new run if the previous one is still running.
Allow(default) — multiple jobs can run at the same time.Forbid— skip the new run if old one still running.Replace— kill the old run and start a new one.
2️⃣
Remediation & Permanent Safeguards
Options: Also check startingDeadlineSeconds — if a job is missed (e.g., cluster was down), Kubernetes may try to catch up on missed runs. --- ## 🟢 Networking
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Pro-Tip: Allow (default) — multiple jobs can run at the same time.."
⚡ 60-Second Elevator Pitch Talking Points
- Allow (default) — multiple jobs can run at the same time.
- Forbid — skip the new run if old one still running.
- Replace — kill the old run and start a new one.
Advertisement