-
-
Save Tirael/032e7276f4ddc946ad1dfe92e8623642 to your computer and use it in GitHub Desktop.
Kubernetes: dump all keys in secret to files:
This file contains hidden or 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
# Requirements: kubectl and yq ( https://github.com/kislyuk/yq ) | |
# This will take every key/value in a secret, base64 decode the value, and dump the result to | |
# a file named as the key name | |
SECRET=credentials-staging NAMESPACE=staging | |
for i in `kubectl -n ${NAMESPACE} get secret ${SECRET} -o yaml --export|yq -r '.data | keys[]'` | |
do | |
echo "Dumping ${i}" | |
kubectl -n ${NAMESPACE} get secret ${SECRET} -o yaml --export|yq -r '.data."'${i}'"' | base64 -d > ${i} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment