Kubernetes and Cloud Native Associate (KCNA) — Question 52
How do you perform a command in a running container of a Pod?
Answer options
- A. kubectl exec--
- B. docker exec
- C. kubectl run--
- D. kubectl attach-i
Correct answer: A
Explanation
The correct answer is A, 'kubectl exec--', as it is specifically designed to run commands within a container of a Pod in Kubernetes. Option B, 'docker exec', is used for Docker containers directly, while C and D are not the correct commands for executing commands in a running Pod's container.