CKA Troubleshooting Practice Question
Which command shows all events in the cluster sorted by timestamp?
⚠ Common exam trap
The CKA exam is open-book (using official documentation). If you search the official docs for sorting events, it explicitly directs you to use `kubectl get events --sort-by='.metadata.creationTimestamp'`. Relying on default behavior without the flag can lead to incorrect assumptions or missed points on the exam.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
kubectl get events --sort-by=.metadata.creationTimestamp
According to the official Kubernetes Cheat Sheet, the standard and documented command to list events sorted by timestamp is `kubectl get events --sort-by='.metadata.creationTimestamp'`. While modern versions of kubectl apply some default sorting, using the explicit `--sort-by` flag is the precise, guaranteed, and exam-expected method.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
kubectl describe events
Why it's wrong here
A is incorrect because `kubectl describe events` shows detailed information about events but does not list them in a sorted manner; it's not the standard command for viewing all events sorted by time.
- ✗
kubectl get events
Why it's wrong here
B is correct because `kubectl get events` retrieves all events sorted by lastTimestamp by default, meeting the requirement.
- ✗
kubectl logs --all-namespaces
Why it's wrong here
C is incorrect because `kubectl logs` retrieves container logs, not events.
- ✓
kubectl get events --sort-by=.metadata.creationTimestamp
Why this is correct
D is incorrect because although `--sort-by=.metadata.creationTimestamp` sorts events, it sorts by a different timestamp field (creationTimestamp) than the default (lastTimestamp), and the question expects the default sorting behavior without additional flags. Moreover, the event ordering might not match the intended 'sorted by timestamp' meaning when events have multiple timestamps.
Go deeper
Related to this question
Learn chapter
Kubernetes Architecture Overview
Key term
kubectl Command Reference
kubectl is the command-line tool used to interact with and manage Kubernetes clusters by sending commands to the Kubernetes API.
Key term
Network Policies
A Kubernetes resource that controls how pods communicate with each other and with other network endpoints, acting as a firewall for pod-to-pod traffic.
About these practice questions
One of 302 original CKA practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This CKA practice question is part of Courseiva's free CNCF certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CKA exam.