Backup MySQL databases in Kubernetes
As we are adopting more and more Databases in kubernetes scheme of things, we need to be more vigilant to the Database Management. As part of our Database Management Job we need to keep the backup of the Databases, so we are safe in future if the need arises.
As i need to manage a Kubernetes cluster in IBM Cloud and have MySQL deployements in this cluster. I choose the kubernetes native Cronjob Function to schedule my MySQL DB Backup.
For Traditional MySQL DB Backup/Restore Procedure, Please click Here.
For more details on schduling repitative Job through Kubernetes Cronjob, Please click here.
Lets Start :
We'll schdule the cronjob in the Kubernestes Cluster. You need to clone the mysqldump github repository. Then create the job by using following commands.
Create secret, configmap and job(s)
kubectl create -f mysqldump/mysqldump.configmap.yaml
kubectl create -f mysqldump/mysqldump.secret.yaml
kubectl create -f mysqldump/mysqldump.scheduledjob.all.yaml
Check if the the cronjob is getting created.
kubectl get jobs --watch
References: https://www.camil.org/backup-and-restore-mysql-databases-using-kubernetes-cron-jobs/
0 Comments