根据启动时间降序(descending order)
bashkubectl get pods --sort-by=.metadata.creationTimestamp
根据启动时间升序(ascending order)
bashkubectl get pods --sort-by=.metadata.creationTimestamp | awk 'NR == 1; NR > 1 {print $0 | "tac"}'
kubectl get pods --sort-by=.metadata.creationTimestamp | tail -n +2 | tac
kubectl get pods --sort-by={metadata.creationTimestamp} --no-headers | tac
kubectl get pods --sort-by=.metadata.creationTimestamp | tail -n +2 | tail -r
根据pods的重启次数进行排序
bashkubectl get pods -A --sort-by='.status.containerStatuses[0].restartCount'