Bird
0
0

You want to create a Pod named 'webserver' running the nginx image that does NOT restart automatically if it crashes. Which command should you use?

hard📝 Best Practice Q15 of 15
Kubernetes - Pods
You want to create a Pod named 'webserver' running the nginx image that does NOT restart automatically if it crashes. Which command should you use?
Akubectl run webserver --image=nginx
Bkubectl run webserver --image=nginx --restart=Always
Ckubectl create pod webserver --image=nginx --restart=Never
Dkubectl run webserver --image=nginx --restart=Never
Step-by-Step Solution
Solution:
  1. Step 1: Understand restart policies in kubectl run

    Using --restart=Never creates a Pod with restart policy 'Never', so it won't restart automatically.
  2. Step 2: Evaluate each option

    kubectl run webserver --image=nginx --restart=Never correctly uses --restart=Never. kubectl run webserver --image=nginx --restart=Always uses --restart=Always which creates a Deployment that restarts Pods. kubectl create pod webserver --image=nginx --restart=Never uses invalid syntax. kubectl run webserver --image=nginx creates a Deployment by default.
  3. Final Answer:

    kubectl run webserver --image=nginx --restart=Never -> Option D
  4. Quick Check:

    --restart=Never means Pod won't auto-restart [OK]
Quick Trick: Use --restart=Never to prevent Pod auto-restart on failure [OK]
Common Mistakes:
  • Using default restart which creates Deployment
  • Confusing --restart=Always with no restart
  • Trying invalid commands like kubectl create pod

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes