Last active
December 29, 2023 04:55
-
-
Save ngeorger/62ee4e5369d8609524b88288fd4b88c3 to your computer and use it in GitHub Desktop.
Backup or dump kubernetes secrets by namespaces
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
#!/usr/bin/bash | |
# This script is based on this one https://kevinsimper.medium.com/how-to-dump-all-kubernetes-secrets-to-yaml-files-b5afcf2d1f56 | |
# But also it reads every namespace in your current default context and dumps it's secrets as a file named as the namespace and yml extension | |
# Tested on non-productive environments. | |
kubectl get namespaces | awk '{print $1}' | xargs -I{} sh -c 'kubectl get secrets -o yaml -n "$1" --no-headers >> "$1.yaml"' - {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment