- List all “PV”s sorted by name saving the full kubectl output to /var/CKA2022/my_volumes
- Use kubectl’s own functionally for sorting the output, and do not manipulate it any further
kubectl get pv --sort-by=.metadata.name > /var/CKA2022/my_volumes
cat /var/CKA2022/my_volumes
출처