Last active
February 27, 2022 03:06
-
-
Save rhemz/eb7c918706907d7130becf459200d49f to your computer and use it in GitHub Desktop.
k8s mysqldump to digitalocean space
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
# just wrap this in a CronJob. | |
# this example uses https://github.com/schickling/dockerfiles/tree/master/mysql-backup-s3 | |
# ideally you use a backup image you trust in your own CR | |
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: mysqldump-to-spaces | |
namespace: db | |
spec: | |
containers: | |
- name: mysqldump | |
image: schickling/mysql-backup-s3@sha256:cacebe37690e98e481261ce2d59e4dfc50c8fa3653cbe9eff85c14393bd02e90 | |
imagePullPolicy: IfNotPresent | |
env: | |
- name: MYSQLDUMP_DATABASE | |
value: "YOUR DATABASE NAME" | |
- name: S3_ENDPOINT | |
value: "https://YOUR REGION.digitaloceanspaces.com" | |
- name: S3_BUCKET | |
value: "YOUR SPACE NAME (just the name, not the fqdn)" | |
- name: S3_PREFIX | |
value: "path/to/base/dumps/dir" | |
- name: MYSQL_HOST | |
value: "mysql57.db.svc.cluster.local" | |
envFrom: | |
- secretRef: | |
name: db-backup-creds | |
restartPolicy: Never | |
--- | |
apiVersion: v1 | |
kind: Secret | |
metadata: | |
name: db-backup-creds | |
namespace: db | |
type: Opaque | |
data: | |
S3_ACCESS_KEY_ID: | |
S3_SECRET_ACCESS_KEY: | |
MYSQL_USER: | |
MYSQL_PASSWORD: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment