Bird
0
0

To open an interactive shell inside the container named worker of Pod job-pod, which command is correct?

hard📝 Workflow Q8 of 15
Kubernetes - Pods
To open an interactive shell inside the container named worker of Pod job-pod, which command is correct?
Akubectl exec job-pod /bin/bash -c worker
Bkubectl exec -it job-pod -c worker -- /bin/bash
Ckubectl exec -c worker job-pod /bin/bash -it
Dkubectl exec job-pod -it --worker /bin/bash
Step-by-Step Solution
Solution:
  1. Step 1: Identify flags

    -it is for interactive terminal, -c specifies container.
  2. Step 2: Correct order

    Syntax is kubectl exec -it [pod] -c [container] -- [command].
  3. Step 3: Apply to example

    Pod: job-pod, container: worker, command: /bin/bash.
  4. Final Answer:

    kubectl exec -it job-pod -c worker -- /bin/bash -> Option B
  5. Quick Check:

    Is container specified with -c before --? Yes. [OK]
Quick Trick: Use -it and -c before -- for interactive shell [OK]
Common Mistakes:
  • Placing container name after command
  • Misordering flags and arguments

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes