Q: How do you configure a pod to get secrets from HashiCorp Vault without modifying app code?
Use Vault Agent Injector (Vault installed in K8s). Annotate the pod:
#Kubernetes #Additional Kubernetes Scenarios (Q101-Q200) #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️⃣
Production Solution & Architecture
Use Vault Agent Injector (Vault installed in K8s). Annotate the pod: The Vault Agent sidecar is injected into the pod. It authenticates with Vault using K8s ServiceAccount token, fetches the secrets, and writes them to a shared volume at /vault/secrets/. App reads files. No code change needed.
annotations:
vault.hashicorp.com/agent-inject: "true"
vault.hashicorp.com/role: "my-app"
vault.hashicorp.com/agent-inject-secret-config: "secret/data/myapp"
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Pro-Tip: Use Vault Agent Injector (Vault installed in K8s). Annotate the pod:."
⚡ 60-Second Elevator Pitch Talking Points
- Immediate Triage: Use Vault Agent Injector (Vault installed in K8s). Annotate the pod:
- Run targeted verification commands before modifying configuration.
- Automate permanent guardrails (CI check, alerts, IaC policy) to prevent recurrence.
Advertisement