Bird
0
0

You want to add a sidecar container to your pod that automatically refreshes configuration files every minute without restarting the main app. Which approach best fits this requirement?

hard📝 Best Practice Q15 of 15
Kubernetes - Pods
You want to add a sidecar container to your pod that automatically refreshes configuration files every minute without restarting the main app. Which approach best fits this requirement?
AAdd an initContainer to update config files before the main app starts
BUse a sidecar container that watches config files and updates a shared volume mounted by the main app
CRestart the main app container every minute using a Kubernetes cron job
DUse a separate pod to update config files and restart the main app pod
Step-by-Step Solution
Solution:
  1. Step 1: Understand sidecar role for live config updates

    A sidecar container can run alongside the main app and update shared config files dynamically without restarting the main app.
  2. Step 2: Evaluate other options for live updates

    InitContainers run only once before the main app starts, so they can't refresh configs continuously. Restarting the main app or using separate pods is less efficient and disrupts availability.
  3. Final Answer:

    Use a sidecar container that watches config files and updates a shared volume mounted by the main app -> Option B
  4. Quick Check:

    Sidecar updates shared config live without app restart [OK]
Quick Trick: Sidecar can update shared files live; initContainers run once [OK]
Common Mistakes:
  • Using initContainers for continuous updates
  • Restarting main app unnecessarily
  • Using separate pods causing complexity

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes