tohjustin/kube-lineage

Feature request: PVs and PVCs

zxti opened this issue ยท 2 comments

zxti commented

Thank you for this wonderful tool!

I saw that it lists PVs and PVCs as supported object relationship, but it doesn't seem to make any connection between PVs and PVCs (doesn't seem to follow claimRefs). This would be great to be able to connect PVs with the rest of the graph (including pods, etc.)!

Hi @zxti, glad this tool was useful to you! ๐Ÿ™‚

We do actually support PV & PVCs, but please do submit a GitHub issue if you think the tool isn't showing the relationships between PV & PVCs properly ๐Ÿ™

Here's an example of using kube-lineage with a PV created by a Prometheus StatefulSet:

$ kubectl lineage PersistentVolume/pvc-e4b8a541-77be-4eb8-86d3-744bac7472d7 -o wide
NAMESPACE           NAME                                                                READY   STATUS    AGE   RELATIONSHIPS
                    PersistentVolume/pvc-e4b8a541-77be-4eb8-86d3-744bac7472d7           -                 1d    []
monitoring-system   โ””โ”€โ”€ PersistentVolumeClaim/prometheus-k8s-db-prometheus-k8s-0        -                 1d    [PersistentVolumeClaim]
monitoring-system       โ””โ”€โ”€ Pod/prometheus-k8s-0                                        4/4     Running   1d    [PodVolume]
monitoring-system           โ”œโ”€โ”€ Service/prometheus-k8s                                  -                 1d    [Service]
monitoring-system           โ”‚   โ””โ”€โ”€ EndpointSlice/prometheus-k8s-sltm9                  -                 1d    [ControllerReference OwnerReference]
monitoring-system           โ”œโ”€โ”€ Service/prometheus-k8s-thanos-sidecar                   -                 1d    [Service]
monitoring-system           โ”‚   โ””โ”€โ”€ EndpointSlice/prometheus-k8s-thanos-sidecar-gjbcm   -                 1d    [ControllerReference OwnerReference]
monitoring-system           โ””โ”€โ”€ Service/prometheus-operated                             -                 1d    [Service]
monitoring-system               โ””โ”€โ”€ EndpointSlice/prometheus-operated-2hltw             -                 1d    [ControllerReference OwnerReference]

Here's an example of using kube-lineage with a PVC created by a Prometheus StatefulSet.

$ kubectl lineage PersistentVolumeClaim/prometheus-k8s-db-prometheus-k8s-0 --dependencies -o wide
NAMESPACE           NAME                                                             READY   STATUS         AGE   RELATIONSHIPS
monitoring-system   PersistentVolumeClaim/prometheus-k8s-db-prometheus-k8s-0         -                      1d    []
                    โ””โ”€โ”€ PersistentVolume/pvc-e4b8a541-77be-4eb8-86d3-744bac7472d7    -                      1d    [PersistentVolumeClaim]
                        โ”œโ”€โ”€ StorageClass/gp2                                         -                      1d    [PersistentVolumeStorageClass]
                        โ””โ”€โ”€ VolumeAttachment/csi-XXXXXXXXXXXXXXXXXXXXXXXXXXX         True                   1d    [VolumeAttachmentSourceVolume]
                            โ”œโ”€โ”€ CSIDriver/ebs.csi.aws.com                            -                      1d    [VolumeAttachmentAttacher]
                            โ”‚   โ””โ”€โ”€ CSINode/ip-X-X-X-X.us-east-1.compute.internal    -                      1d    [CSINodeDriver]
                            โ”‚       โ””โ”€โ”€ Node/ip-X-X-X-X.us-east-1.compute.internal   True    KubeletReady   1d    [OwnerReference]
                            โ””โ”€โ”€ Node/ip-X-X-X-X.us-east-1.compute.internal           True    KubeletReady   1d    [VolumeAttachmentNode]
zxti commented

You're right! I simply hadn't specified -A to cross namespaces. Amazing, thank you.