Skip to content

Instantly share code, notes, and snippets.

@GuyPaddock
Last active March 31, 2024 02:27
Show Gist options
  • Save GuyPaddock/d749ebaed0b209fd7fa81df71d82065f to your computer and use it in GitHub Desktop.
Save GuyPaddock/d749ebaed0b209fd7fa81df71d82065f to your computer and use it in GitHub Desktop.
Delete Kubernetes PVs that Match Specific Naming Pattern
#!/usr/bin/env bash
set -uo pipefail
PATTERN="${1}"
echo "${PATTERN}"
echo kubectl delete pvc $(kubectl get pvc | grep "${PATTERN}" | awk '{ print $1 }')
echo kubectl delete pv $(kubectl get pv | grep "${PATTERN}" | awk '{ print $1 }')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment