Skip to content

Instantly share code, notes, and snippets.

@elarib
Last active October 24, 2023 19:10
Show Gist options
  • Save elarib/1231df8a2c4b0442da381329c99b9ee6 to your computer and use it in GitHub Desktop.
Save elarib/1231df8a2c4b0442da381329c99b9ee6 to your computer and use it in GitHub Desktop.
Dump all kubernetes secrets configmaps to yaml files
NAMESPACE=YOUR_NAMESPACE_HERE && \
kubectl -n $NAMESPACE get --no-headers configmaps | awk '{print $1}' | \
xargs -I {} sh -c "kubectl -n $NAMESPACE get configmaps {} -o yaml > {}.yaml"
NAMESPACE=YOUR_NAMESPACE_HERE && \
kubectl -n $NAMESPACE get --no-headers secrets --field-selector type=Opaque | awk '{print $1}' | \
xargs -I {} sh -c "kubectl -n $NAMESPACE get secret {} -o yaml > {}.yaml"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment