Bird
0
0

Given this pod YAML snippet, what will happen when the pod starts?

medium📝 Command Output Q13 of 15
Kubernetes - Pods
Given this pod YAML snippet, what will happen when the pod starts?
spec:
  containers:
  - name: app
    image: myapp:latest
  - name: logger
    image: log-collector:latest
    volumeMounts:
    - name: shared-logs
      mountPath: /var/log/app
  volumes:
  - name: shared-logs
    emptyDir: {}
ABoth containers start; logger collects logs from app via shared volume
BOnly the app container starts; logger container fails due to missing volume
CPod fails to start because volumes are not defined correctly
DLogger container starts but cannot access app logs
Step-by-Step Solution
Solution:
  1. Step 1: Analyze pod containers and volumes

    There are two containers: app and logger. Logger mounts a shared volume shared-logs at /var/log/app. The volume is defined as emptyDir, which is a temporary shared storage.
  2. Step 2: Understand sidecar volume sharing

    Both containers share the emptyDir volume, so logger can access logs written by app in that path.
  3. Final Answer:

    Both containers start; logger collects logs from app via shared volume -> Option A
  4. Quick Check:

    Shared emptyDir volume enables log sharing [OK]
Quick Trick: Shared emptyDir volume means containers share files [OK]
Common Mistakes:
  • Assuming volume is missing or misconfigured
  • Thinking containers run independently without shared storage
  • Confusing emptyDir with persistent volume

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes