I can sort my Kubernetes pods by name using:
kubectl get pods --sort-by=.metadata.name
How can I sort them (or other resoures) by age using
If you are trying to get the most recently created pod you can do the following
kubectl get pods --sort-by=.metadata.creationTimestamp -o jsonpath='{.items[-1:].metadata.name}'
Note the -1: gets the last item in the list, then we return the pod name
-1: