KCNA Exam QuestionsBrowse all questions from this exam

KCNA Exam - Question 20


Which is the correct kubectl command to display logs in real time?

Show Answer
Correct Answer: D

To display logs in real time for a Kubernetes container, the correct kubectl command is 'kubectl logs -f test-container-1'. The '-f' flag stands for 'follow', which streams the log output in real-time. This allows for continuous monitoring by displaying log entries as they are generated.

Discussion

3 comments
Sign in to comment
nvtienanhOption: D
Oct 3, 2023

D is correct

phcunhaOption: D
Mar 22, 2024

D. kubectl logs -f test-container-1 Explanation: The -f flag in the kubectl logs command stands for "follow," which allows you to continuously stream the logs in real-time as new log entries are added. This is useful for monitoring applications or troubleshooting issues as they occur. An analogy for this command could be tuning in to a live radio broadcast. When you listen to a live radio show, you want to hear the content as it's being broadcasted, rather than just a recording of past broadcasts. Similarly, using kubectl logs -f lets you "tune in" to the ongoing activity of a container, receiving log updates in real-time.

dadaarceOption: D
Mar 28, 2024

The -f or --follow flag is used to stream logs in real time.