按时间排序,可以更快地找到最近更新的pod
基于当前ns
kubectl get pods --sort-by=.metadata.creationTimestamp
基于整个集群
kubectl get pods -A --sort-by=.metadata.creationTimestamp
也可以按Pod的状态排序,快速找到不正常的Pod
kubectl get pods --sort-by=.status.phase
–sort-by可以对k8s所有的api对象的进行排序(只要对应的字段是integer或者string)
--sort-by='': If non-empty, sort list types using this field specification.
The field specification is expressed as a JSONPath expression (e.g. '{.metadata.name}').
The field in the API resource specified by this JSONPath expression must be an integer or a string.
版权声明:本文为qq_41832237原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。