The DB Operator eases the pain of managing PostgreSQL and MySQL instances for applications running in Kubernetes. The Operator creates databases and make them available in the cluster via Custom Resource. It is designed to support the on demand creation of test environments in CI/CD pipelines.
DB Operator provides following features:
- Create/Delete databases on the database server running outside/inside Kubernetes by creating
Database
custom resource; - Create Google Cloud SQL instances by creating
DbInstance
custom resource; - Automatically create backup
CronJob
with defined schedule (limited feature);
- How it works - a general overview and definitions
- Creating Instances - make database instances available for the operator
- Creating Databases - creating databases in those instances
- Enabling regular Backup - and schedule cronjob
- Upgrade guide - breaking changes and guide for the upgrade
$ helm repo add db-operator https://kloeckner-i.github.io/db-operator/
$ helm install --name my-release db-operator/db-operator
To see more options of helm values here
To see which version is working together check out our version matrix.
To have kubernetes environment locally, you need to install minikube or microk8s.
addexamples add examples via kubectl create -f examples/
build build db-operator docker image
controller-gen Download controller-gen locally if necessary.
generate generate supporting code for custom resource types
helm install helm if not exist and install local chart using helm upgrade --install command
helm-lint lint helm manifests
help show this help
k3d_setup install microk8s locally and deploy db-operator (only for linux and mac)
manifests generate custom resource definitions
minidashboard open minikube dashboard
minidelete delete minikube
minidown stop minikube
miniup start minikube
setup build db-operator image, install helm
test spin up mysql, postgres containers and run go unit test
update build db-operator image again and delete running pod
$ make miniup
$ make setup
rebuild CRD manifests
$ make manifests
rebuild local docker image
$ make build
delete running db-operator and apply new image
$ make deploy
or both at once
$ make update
$ make helm
$ make k3d_setup
rebuild local docker image
$ make k3d_build
delete running db-operator and apply new image
$ make deploy
$ make helm
- Microk8s supports only linux environment. Non linux user can use microk8s using vm for example multipass. Please find details here
$ make microsetup
microsetup is used for our integration test in pipeline.
$ make test