You want to inspect the real-time logs of a running container named 'app-container' within a pod named 'web-pod'. Which kubectl command should you run?

Direct Answer (Verified)Reviewed by Sunny (Senior Cloud Engineer)

Correct Answer: kubectl logs web-pod -c app-container

The 'kubectl logs' command retrieves logs for a container. The '-c' flag specifies the container name if the pod has multiple containers....

Real Exam ScenarioKubernetes CLI

You want to inspect the real-time logs of a running container named 'app-container' within a pod named 'web-pod'. Which kubectl command should you run?

✓ Correct Answer & ExplanationKubernetes CLI

Correct Answer

kubectl logs web-pod -c app-container

Why This Answer Is Correct

The 'kubectl logs' command retrieves logs for a container. The '-c' flag specifies the container name if the pod has multiple containers.

📚 What This Question Tests

This question evaluates your knowledge of Kubernetes CLI — a core concept tested in cloud certification exams. Understanding Kubernetes CLI is essential for designing scalable, secure, and cost-effective cloud architectures. Mastery of this topic will help you answer scenario-based questions confidently on exam day.