Kubernetes: Sort events from older to newer

Published at 22 Apr 2025

While debuging a Kubernetes cluster it's common to see the events registered using the command:

kubectl get events -A

This events are sorted by default using the namespace, to sort them from older to newer using the last seen column, you should run the command with the parameter --sort-by='.lastTimestamp':

kubectl get events -A --sort-by='.lastTimestamp'