An administrator is managing a Kubernetes cluster. A pod is running but not responding as expected. The administrator wants to view the standard output logs from the pod's main container. Which kubectl command should be used?
kubectl logs retrieves stdout and stderr written by the pod's main container, satisfying the requirement to view standard output. Other verbs such as describe or exec do not stream container logs, so they fail the stated constraint.
Why this answer
The kubectl logs <pod-name> command retrieves the standard output (stdout) and standard error (stderr) logs from a pod's container, which is exactly what the administrator needs. By default it targets the main container; if multiple containers exist, -c <container> specifies one. This is the standard way to view application logs without exec'ing into the container.
Exam trap
The trap is assuming logs live in a file inside the container — candidates pick exec + cat, but Kubernetes captures stdout/stderr, and kubectl logs is the canonical command.
How to eliminate wrong answers
Option A is wrong because kubectl exec runs a command inside the container; cat /var/log/app.log assumes the app writes to that file, which is not guaranteed and does not retrieve the container's stdout stream. Option B is wrong because kubectl get pod -o yaml returns the pod's YAML manifest (spec and status), not runtime logs. Option C is wrong because kubectl describe pod shows events, conditions, and metadata about the pod, useful for troubleshooting scheduling or image pull issues, but not application stdout logs.