How to sort the output of kubectl by a field

kubectl get pods --sort-by=<field>
kubectl get po -n kube-system --sort-by='{.metadata.creationTimestamp}'
kubectl get po -n kube-system -o json

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Utkarsh Shigihalli

Utkarsh Shigihalli

36 Followers

Microsoft MVP | Developer | Passionate about Cloud, .NET and DevOps