Kubernetes and Cloud Native Associate (KCNA) — Question 14

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

Answer options

Correct answer: D

Explanation

The correct answer is D, as the '-f' flag allows you to follow log output in real-time. Option A uses '-p', which shows logs from the previous instance, while B uses '-c', which specifies the container name but does not indicate real-time logging. Option C uses '-l', which filters logs by label, but again does not provide real-time output.