Back to Charts

mysqldump

stable/mysqldump/README.md

latest11.3 KB
Original Source

mysqldump

CHART WAS DEPRECATED AND MOVED TO https://github.com/kokuwaio/helm-charts/tree/main/charts/mysqldump

mysqldump is a tool for creating backups of MySQL databases in the form of a .sql file.

TLDR

console
helm install stable/mysqldump \
  --set mysql.host=mysql;mysql.username=root,mysql.password=password,persistence.enabled=true

Introduction

This chart helps set up a cronjob or one time job to backup a MySQL database with mysqldump into a Persistent Volume. You can specify an existing PVC, or helm will create one for you.

Prerequisites

  • Kubernetes 1.8

Installing the Chart

To install the chart with the release name my-release:

console
helm install stable/mysqldump \
  --set mysql.host=mysql,mysql.username=root,mysql.password=password,persistence.enabled=true

This command will create a cronjob to run a job once a day to backup the databases found on the host mysql

Tip: List all releases using helm list

Uninstalling the Chart

To uninstall/delete the my-release deployment:

console
helm delete my-release

The command removes all the Kubernetes components associated with the chart and deletes the release.

Configuration

The following tables lists the configurable parameters of the mysqldump chart and their default values.

ParameterDescriptionDefault
image.repositoryName of image to usemonotek/gcloud-mysql
image.tagVersion of image to use"8"
image.pullPolicyPull Policy to use for imageIfNotPresent
mysql.dbsingle mysql db to backup (optional)mysql
mysql.hostmysql host to backupmysql
mysql.usernamemysql usernameroot
mysql.passwordmysql password""
mysql.existingSecretexisting secret name, used to get mysql password (if set)
mysql.existingSecretKeyexisting secret keymysql-root-password
mysql.portmysql port3306
schedulecrontab schedule to run on. set as now to run as a one time job"0 3 * * *"
optionsoptions to pass onto MySQL"--opt --single-transaction"
debugprint some extra debug logs during backupfalse
dumpAllToStdoutdump all database contents to stdout when not uploadingfalse
additionalStepsrun these extra shell steps after all backup jobs completed[]
successfulJobsHistoryLimitnumber of successful jobs to remember5
failedJobsHistoryLimitnumber of failed jobs to remember5
persistentVolumeClaimexisting Persistent Volume Claim to backup to, leave blank to create a new one
persistence.enabledcreate new PVC (unless persistentVolumeClaim is set)true
persistence.sizesize of PVC to create8Gi
persistence.accessModeaccessMode to use for PVCReadWriteOnce
persistence.storageClassstorage class to use for PVC
persistence.subPathsubPath for PVC
allDatabases.enabledbackup all databasestrue
allDatabases.SingleSqlFilebackup all databases to single filefalse
housekeeping.enableddelete olf backups in pvctrue
housekeeping.keepDayskeep last x days of backups in PVC10
saveToDirectorysaves the sql backup to a directory named like the database or alldatabasesfalse
upload.googlestoragebucket.enabledupload backups to google storagefalse
upload.googlestoragebucket.bucketnamegoogle storage addressgs://mybucket/test
upload.googlestoragebucket.jsonKeyfilejson keyfile for serviceaccount""
upload.googlestoragebucket.existingSecretspecify a secretname to usenil
upload.googlestoragebucket.usingGCPControllerenable the use of the GCP Service Account Controllerfalse
upload.googlestoragebucket.serviceAccountNamespecify a service account name to usenil
upload.ssh.enabledupload backups via sshfalse
upload.ssh.userssh userbackup
upload.ssh.hostssh server urlyourdomain.com
upload.ssh.dirdirectory on server/backup
upload.ssh.privatekeyssh user private key""
upload.openstack.enabledupload backups via swift to openstackfalse
upload.openstack.useruser namebackup@mydomain
upload.openstack.userDomainuser domaindefault
upload.openstack.passworduser password, overriden by existingSecret/existingSecretKey if set
upload.openstack.authUrlopenstack auth url (v3)https://mydomain:5000/v3
upload.openstack.projectproject namemy_project
upload.openstack.projectDomainproject domaindefault
upload.openstack.destinationdestination path, starting witch containerbackup/mysql
upload.openstack.existingSecretoptional, specify a secret name to use for password
upload.openstack.existingSecretKeyoptional, specify a secret key to use for passwordopenstack-backup-password
upload.openstack.ttlDaysdays to set time-to-live on uploaded objects (0 to disable)30
resourcesresource definitions{}
nodeSelectornode selector{}
tolerationstolerations[]
affinityaffinity{}
securityContext.enabledset true to change default security context of job/cronjobfalse
securityContext.fsGroupgroup id to use999
securityContext.runAsUseruser id to use999

Auto generating the gcp service account

By enabling the flag upload.googlestoragebucket.usingGCPController and having a GCP Service Account Controller deployed in your cluster, it is possible to autogenerate and inject the service account used for the storage bucket access. For more information see https://github.com/kiwigrid/helm-charts/tree/master/charts/gcp-serviceaccount-controller

console
helm install stable/mysqldump --name my-release \
    --set persistentVolumeClaim=name-of-existing-pvc

Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,

console
helm install stable/mysqldump --name my-release -f values.yaml