Skip to content

Instantly share code, notes, and snippets.

@MrHassanMurtaza
Last active June 30, 2022 10:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MrHassanMurtaza/8f8d29c07b44aff7e37b82350b76f572 to your computer and use it in GitHub Desktop.
Save MrHassanMurtaza/8f8d29c07b44aff7e37b82350b76f572 to your computer and use it in GitHub Desktop.
Remove claimRef from all persistent volumes using kubectl
#!/bin/bash
set -ex
for i in $(kubectl get pv | awk '{print $1}');
do
kubectl patch pv $i --type=json -p '[{"op": "remove", "path": "/spec/claimRef"}]'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment