❓Why one works but not the other. ``` controlplane ~ ➜ k get persiste . . .

Ashok Gangwar:
:question:Why one works but not the other.

controlplane ~ ➜  k get persistentvolume -o=jsonpath='{.items[*].spec.capacity}'
{"storage":"100Mi"} {"storage":"200Mi"} {"storage":"300Mi"} {"storage":"40Mi"}

controlplane ~ ➜  k get persistentvolume --sort-by='{.items[*].spec.capacity}'
No resources found

Trung Tran:
try this
kubectl get pv --sort-by='.spec.capacity.storage'

Trung Tran:

Ashok Gangwar:
Yeah I got that but just wondering why the other one not works with --sort-by .

Leo Pastor:
@Ashok Gangwar In fact the first command does not sort anything, you just requested a list objects (even when the output is sorted). The second command requests a list of objects and you are trying to apply an expression that is aimed to be used with jsonpath to filter output - It does not sort.