Kubernetes: Use kubectl to get information about PersistentVolume of a Pod

Posted on Apr 28, 2022
Note: This article was written a while ago and may contain outdated information. Please verify the details before relying on it. If I express opinions or recommendations, they might not reflect my current views. For this reason, I recommend checking for more recent articles on the same topic.

If you want to use kubectl to get information about a PersistentVolume of a Pod, then use the following steps:

Get information about the Pod:

kubectl describe pod [POD_NAME] -n [NAMESPACE]

This will give you information about the Pod. Search for PersistentVolumeClaim. Or grep it with:

kubectl describe pod [POD_NAME] -n [NAMESPACE]e | grep 'PersistentVolumeClaim' -A 1

Use the ClaimName part to get information about the PersistentVolumeClaim:

kubectl describe pvc [CLAIM_NAME] -n [NAMESPACE]

Get the Volume out of the result of the above command and use it to describe the Volume:

kubectl describe pv [PERSISTENT_VOLUME] -n [NAMESPACE]