Created
July 29, 2018 14:16
-
-
Save andromedarabbit/e3e6adfb09583a6a00d5a1765a3977cb to your computer and use it in GitHub Desktop.
kuberbetes-set-reclaimpolicy-to-retain.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# See https://kubernetes.io/docs/tasks/administer-cluster/change-pv-reclaim-policy/ | |
set -eo pipefail | |
echo ">>> BEFORE" | |
kubectl get pv | |
kubectl patch pv $(kubectl get pv -o json | jq -r '.items[] | select(.spec .persistentVolumeReclaimPolicy != "Retain") | .metadata .name') -p '{"spec":{"persistentVolumeReclaimPolicy":"Retain"}}' | |
echo ">>> AFTER" | |
kubectl get pv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment