Bird
0
0

Given this Pod spec snippet, what will happen when the Pod starts?

medium📝 Command Output Q13 of 15
Kubernetes - Pods
Given this Pod spec snippet, what will happen when the Pod starts?
initContainers:
- name: wait-for-db
  image: busybox
  command: ['sh', '-c', 'until nslookup db-service; do echo waiting; sleep 2; done']
containers:
- name: app
  image: myapp
AThe init container runs in parallel with the app container
BThe app container starts immediately without waiting
CThe Pod fails because 'nslookup' is not a valid command
DThe init container waits until 'db-service' DNS resolves before app starts
Step-by-Step Solution
Solution:
  1. Step 1: Understand init container behavior

    Init containers run before app containers and must complete successfully before the app starts.
  2. Step 2: Analyze the command in init container

    The command loops until the DNS name 'db-service' resolves, so it waits for the database service to be ready.
  3. Final Answer:

    The init container waits until 'db-service' DNS resolves before app starts -> Option D
  4. Quick Check:

    Init container waits for service readiness [OK]
Quick Trick: Init containers run sequentially and block app start [OK]
Common Mistakes:
  • Thinking init containers run in parallel
  • Assuming app starts immediately
  • Believing 'nslookup' is invalid in busybox

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes