Created
October 30, 2018 08:06
-
-
Save Ivan-Feofanov/4585d81956a326f17fd35cffb656963b to your computer and use it in GitHub Desktop.
backup postgres db in kubernetes
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
DB_NAME=$1 | |
NAMESPACE=$@ | |
POD=$(kubectl -n="$NAMESPACE" get pods -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}' --selector=app=postgres) | |
kubectl -n="$NS" exec "$POD" pg_dump -Fc --no-acl --no-owner -h localhost -U postgres -w "$DB_NAME" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment