KCNA Exam QuestionsBrowse all questions from this exam

KCNA Exam - Question 68


Which of the following will view the snapshot of previously terminated ruby container logs from Pod web-1?

Show Answer
Correct Answer: A

To view the snapshot of previously terminated logs of a specific container within a pod, the correct syntax is needed. The command to achieve this entails specifying the previous logs with '-p' and the target container with '-c'. Therefore, the correct command is kubectl logs -p -c ruby web-1, which accurately specifies that it refers to the previous logs of the 'ruby' container in the 'web-1' pod.

Discussion

4 comments
Sign in to comment
PinkAndBlackOption: B
Dec 28, 2023

The correct syntax should be the following: kubectl logs web-1 -c ruby Check https://kubernetes.io/docs/reference/kubectl/quick-reference/#interacting-with-running-pods

ncsikiOption: A
Jan 2, 2024

Return snapshot of previous terminated ruby container logs from pod web-1 kubectl logs -p -c ruby web-1 https://jamesdefabia.github.io/docs/user-guide/kubectl/kubectl_logs/

dimozOption: A
Jan 6, 2024

https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#logs: -- Return snapshot of previous terminated ruby container logs from pod web-1 kubectl logs -p -c ruby web-1

pulsefireOption: A
Mar 7, 2024

-p previous -c container