Q: You need to run a pod that will only start after a specific ConfigMap exists in the cluster. How do you implement this?
Use an init container that polls for the ConfigMap:
#Kubernetes #Advanced Scenarios #L3 #Container Orchestration #K8s
🎙️ Candidate Opening & Architectural Context
""In one of our high-traffic production clusters, our SRE team handled this incident using a standardized runbook. 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️⃣
Production Solution & Architecture
Use an init container that polls for the ConfigMap: The init container keeps checking every 5 seconds until the ConfigMap exists, then exits (allowing the main container to start). This pattern is common for sequencing: wait for a database to be ready, wait for a service to exist, wait for a secret to be populated.
initContainers:
- name: wait-for-config
image: bitnami/kubectl
command: ['sh', '-c', 'until kubectl get configmap my-config; do echo waiting; sleep 5; done']
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Pro-Tip: Use an init container that polls for the ConfigMap:."
⚡ 60-Second Elevator Pitch Talking Points
- Immediate Triage: Use an init container that polls for the ConfigMap:
- Run targeted verification commands before modifying configuration.
- Automate permanent guardrails (CI check, alerts, IaC policy) to prevent recurrence.
Advertisement