mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-15 22:38:07 +00:00
Automatic merge from submit-queue (batch tested with PRs 65838, 65837). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. output which pods are a pvc in use when kubectl describe pvc is run **What this PR does / why we need it**: This PR implements a feature request to display the pods mounted to a PVC when `kubectl describe pvc` is ran. We need it since the only way to see which pods are bound to a PVC is by checking the volume mounts of each individual pod in the namespace. Example Output: ``` $ kubectl get pods,pvc NAME READY STATUS RESTARTS AGE test-pod 1/1 Running 0 2h NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE test-pvc Bound pvc-718681dd-70cc-11e7-aa14-42010af00029 100Gi RWO us-east1-b 345d ``` ``` $ kubectl describe pvc Name: elasticsearch-data-elasticsearch-data-us-east1-b-0 Namespace: partners-production StorageClass: us-east1-b Status: Bound Volume: pvc-718681dd-70cc-11e7-aa14-42010af00029 Labels: <none> Annotations: <none> Finalizers: [kubernetes.io/pvc-protection] Capacity: 1Gi Access Modes: RWO Events: <none> Mounted By: test-pod ``` Pods using the PVC are shown with the `Mounted By` field **Which issue(s) this PR fixes**: Closes #65233 **Special notes for your reviewer**: **Release note**: ```release-note Running `kubectl describe pvc` now shows which pods are mounted to the pvc being described with the `Mounted By` field ```