kubectl get events is useless until you sort it
· #kubernetes #kubectl
kubectl get events --sort-by=.lastTimestamp -A
kubectl get eventsreturns in arbitrary order, so the line you need is rarely at the bottom.- Sorting by
.lastTimestampis the difference between reading events and scrolling past them.
The default output order for kubectl get events is not chronological, which
means during an incident the most recent event is somewhere in the middle of the
list. Sorting by .lastTimestamp fixes it, and -A catches the case where the
failure is in a namespace you were not looking at.