Question
List all persistent volumes in following format and sort the volumes based on their capacity and save the output to /tmp/pv-capacity.txt:
VOLUME_NAME CAPACITY NAMESPACE
Answerkubectl get pv -o=custom-columns=VOLUME_NAME:.metadata.name,CAPACITY:.spec.capacity.storage,NAMESPACE:.metadata.namespace --sort-by=.spec.capacity.storage > /tmp/pv-capacity.txt