Bird
0
0

Which of the following is the correct syntax to start an interactive shell inside a container named web in pod frontend-pod?

easy📝 Syntax Q12 of 15
Kubernetes - kubectl Essential Commands
Which of the following is the correct syntax to start an interactive shell inside a container named web in pod frontend-pod?
Akubectl exec -it frontend-pod -c web -- /bin/bash
Bkubectl exec frontend-pod -c web -it /bin/bash
Ckubectl exec -c web frontend-pod /bin/bash -it
Dkubectl exec frontend-pod /bin/bash -c web -it
Step-by-Step Solution
Solution:
  1. Step 1: Recall correct kubectl exec syntax

    The correct syntax for interactive shell is: kubectl exec -it POD_NAME -c CONTAINER_NAME -- /bin/bash. The -it flags come before the pod name, and -- separates command from options.
  2. Step 2: Analyze each option

    kubectl exec -it frontend-pod -c web -- /bin/bash matches the correct syntax exactly. The other options have misplaced flags or arguments causing syntax errors.
  3. Final Answer:

    kubectl exec -it frontend-pod -c web -- /bin/bash -> Option A
  4. Quick Check:

    Correct flag order and -- separator = kubectl exec -it frontend-pod -c web -- /bin/bash [OK]
Quick Trick: Use -it before pod name and -- before command [OK]
Common Mistakes:
  • Placing -it after pod name
  • Omitting -- before command
  • Misordering container flag -c

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes