Question 40
Domain 5: Observability, Troubleshooting, and MaintenanceWhich kubectl command should you use to view Kubernetes Events in a namespace?
Correct answer: A
Explanation
`kubectl get events -n <namespace>` lists the Events resource in the specified namespace. The `-n` flag selects the namespace, and `get events` is the standard kubectl command for viewing event objects recorded by the cluster.
Why each option is right or wrong
A. kubectl get events -n <namespace>
Under the Kubernetes API, Events are namespaced objects, so the `-n` flag is the correct way to scope the query to a specific namespace. `kubectl get events` uses the core resource name `events` to list those event objects, and adding `-n <namespace>` limits the output to that namespace rather than the whole cluster.
B. kubectl describe events -n <namespace>
C. kubectl logs events -n <namespace>
D. kubectl get pods -n <namespace>