Linux Foundation code RUSHABH30: 30% off certifications →

$ cd ../til

kubectl get events is useless until you sort it

· #kubernetes #kubectl

The only form worth aliasing
kubectl get events --sort-by=.lastTimestamp -A

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.