yashbhutwala / kubectl-df-pv

kubectl plugin - giving admins df (disk free) like utility for persistent volumes
Apache License 2.0
410 stars 32 forks source link

duplicate PV #10

Open tcoupin opened 4 years ago

tcoupin commented 4 years ago

When a pv is used by X multiple pods, it appears X times

$ k get pvc
NAME                                        STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS      AGE
data-drive-preprod-mariadb-galera-0         Bound    pvc-5cb1551b-8958-4c4f-8298-42c8c09ab896   1Gi        RWO            rook-ceph-block   35h
data-drive-preprod-mariadb-tooling-backup   Bound    pvc-6ccbd327-3f9f-4c5a-a70b-3575c19d502b   500Mi      RWX            rook-cephfs       57d
drive-preprod-xxx-nextcloud-ncdata          Bound    pvc-02af006f-b180-4e00-b0f9-d2792b81bdf0   1Gi        RWX            rook-cephfs       57d

$ k df-pv
 NAMESPACE  PVC NAME                                   PV NAME                                   POD NAME                                                         VOLUME MOUNT NAME  SIZE    USED   AVAILABLE  %USED  IUSED  IFREE                 %IUSED
 sandbox    data-drive-preprod-mariadb-galera-0        pvc-5cb1551b-8958-4c4f-8298-42c8c09ab896  drive-preprod-mariadb-galera-0                                   data               1014Mi  704Mi  309Mi      69.51  304    523984                0.06
 sandbox    data-drive-preprod-mariadb-tooling-backup  pvc-6ccbd327-3f9f-4c5a-a70b-3575c19d502b  drive-preprod-mariadb-tooling-restore-shell-c5c585478-wxk5m      mariadb            21Gi    516Mi  21Gi       2.34   33296  18446744073709551615  100.00
 sandbox    drive-preprod-xxx-nextcloud-ncdata         pvc-02af006f-b180-4e00-b0f9-d2792b81bdf0  bckp-nextcloud-preprod-xxx-basic-volume-bckp-restore-shellcfgjx  source             21Gi    516Mi  21Gi       2.34   33296  18446744073709551615  100.00
 sandbox    drive-preprod-xxx-nextcloud-ncdata         pvc-02af006f-b180-4e00-b0f9-d2792b81bdf0  drive-preprod-xxx-nextcloud-7b877b4d78-w6cg8                     data               21Gi    516Mi  21Gi       2.34   33296  18446744073709551615  100.00
yashbhutwala commented 4 years ago

@tcoupin thanks for reporting the issue! Granted, I didn't give this much thought, but an argument can be made that it is useful to see it twice to see all the pods that a volume is mounted to. So maybe it's a feature, not a bug? What do you think? What's your usecase?

tcoupin commented 4 years ago

imho, this tool is to view space of PV so I guess only one line by pv. Perhaps you can join all pod names per pv

sweepchild commented 1 year ago

I agree with @tcoupin it will be nice to focus PV, maybe it can deduplicate same PV's. Thanks