Certified Kubernetes Administrator (CKA) Practice Test

Question: 1 / 400

How do you check the logs of a running pod?

By using kubectl reports <pod-name>

By using kubectl logs <pod-name>

To check the logs of a running pod in Kubernetes, the appropriate command is to use "kubectl logs <pod-name>." This command retrieves the logs for a specific pod, allowing you to view the output of the containers running within that pod.

Using "kubectl logs" is essential for troubleshooting and monitoring, as it provides insight into what is happening inside the pod, including any error messages or confirmation that processes are running as expected. You can also specify options such as the container name if the pod has multiple containers, or use flags to get logs from previous instances of the container if it has restarted.

The other commands listed do not serve the purpose of accessing pod logs. For instance, "kubectl reports" and "kubectl view logs" are not valid commands in Kubernetes, while "kubectl status" is typically used to retrieve the status of a resource rather than the logs, failing to provide the necessary log output from the containers. Thus, "kubectl logs <pod-name>" is the correct and functional choice for viewing the logs of a running pod.

Get further explanation with Examzify DeepDiveBeta

By using kubectl status <pod-name>

By using kubectl view logs <pod-name>

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy