Which is the correct kubectl command to display logs in real time?
Which is the correct kubectl command to display logs in real time?
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.
The -f or --follow flag is used to stream logs in real time.
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.
D is correct