https://github.com/sverrirab/postgresql-backup-s3
PostgreSQL backup for Kubernetes clusters
https://github.com/sverrirab/postgresql-backup-s3
kubernetes postgresql
Last synced: 3 months ago
JSON representation
PostgreSQL backup for Kubernetes clusters
- Host: GitHub
- URL: https://github.com/sverrirab/postgresql-backup-s3
- Owner: sverrirab
- License: mit
- Created: 2021-05-15T12:53:07.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2025-01-11T13:00:32.000Z (over 1 year ago)
- Last Synced: 2025-03-29T15:23:32.842Z (over 1 year ago)
- Topics: kubernetes, postgresql
- Language: Shell
- Homepage:
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# postgresql-backup-s3
If you want to take a regular full backup of your PostgreSQL database in your Kubernetes cluster - here is a container and an example cronjob spec.
It simply runs `pg_dumpall` and then `aws s3 cp` - you will need to provide the arguments for those commands to work (see below).
* [Example cronjob and secret](./kubernetes/)
* [Image on Docker hub](https://hub.docker.com/r/sverrirab/postgresql-backup-s3)
## Configuration
### Container specific
| Variable | Required? | Description |
| -------- | --------- | ----------- |
| DEST_S3_BUCKET | YES | S3 bucket name |
| DEST_S3_FOLDER | | S3 folder name |
| DUMPALL_EXTRA_ARGS | | Additional args (e.g. --schema-only for testing configuration) |
### PostgresSQL specific
| Variable | Required? | Description |
| -------- | --------- | ----------- |
| PGUSER | YES | Database user with full access (typically postgres) |
| PGPASSWORD | YES | Database user password|
| PGHOST | YES | Host (e.g. db.namespace.svc.cluster.local |
For more information see: [PostgreSQL env vars](https://www.postgresql.org/docs/13/libpq-envars.html)
### AWS specific
If your machine is running on AWS with permissions provided by a role this is not required.
| Variable | Required? | Description |
| -------- | --------- | ----------- |
| AWS_ACCESS_KEY_ID | | Access key ID |
| AWS_SECRET_ACCESS_KEY | | Secret Access key |
For more information see: [AWS CLI env vars](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html)
## License
Very permissive [MIT License](./LICENSE)
## More information
* [PostgresSQL](https://www.postgresql.org/)
* [Kubernetes](https://kubernetes.io/)