Exam KCNA All QuestionsBrowse all questions from this exam
Question 68

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

    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
pulsefireOption: A

-p previous -c container

dimozOption: A

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

ncsikiOption: A

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/

PinkAndBlackOption: B

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