Kubernetes and Cloud Native Associate (KCNA) — Question 34
Which of the following will view the snapshot of previously terminated ruby container logs from Pod web-1?
Answer options
- A. kubectl logs -p -c ruby web-1
- B. kubectl logs -c ruby web-1
- C. kubectl logs -p ruby web-1
- D. kubectl logs -p -c web-1 ruby
Correct answer: A
Explanation
The correct command is A because it includes the '-p' flag to indicate that it should retrieve logs from a previous instance of the container, along with the correct specification of the container name. Option B does not include the '-p' flag, so it cannot access logs from terminated instances, while C incorrectly places the container name after the Pod name, and D has the same issue as C while also incorrectly ordering the parameters.