Skip to content

Instantly share code, notes, and snippets.

@Pamir
Created March 6, 2019 12:04
Show Gist options
  • Save Pamir/3a7e6cac7acd21e9eefa4af0bc13df25 to your computer and use it in GitHub Desktop.
Save Pamir/3a7e6cac7acd21e9eefa4af0bc13df25 to your computer and use it in GitHub Desktop.
#!/bin/bash
dump_pvinfo(){
namespace=$1
for pvc in $(kubectl get pvc -o=jsonpath="{.items[*].metadata.name}" -n $namespace); do
echo " " $pvc
pv=$(kubectl get pvc -o=jsonpath="{.spec.volumeName}" -n $namespace $pvc)
echo " " $pv
pdName=$(kubectl get pv -o=jsonpath="{.spec.gcePersistentDisk.pdName}" -n $namespace $pv)
echo " " $pdName
done;
}
for namespace in $(kubens); do
echo $namespace
dump_pvinfo $namespace
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment