Managing databases
What databases we use and how to manage them
Postgres
Postgres is managed through the Cloudnative PG (CNPG) which has an extensive documentation you can view to learn more about.
CNPG has a few methods of deployment, the most common is "microservice" which sets up a database cluster dedicated for every application which isn't shared with other applications.
Adding new databases, users and roles
CNPG does not manage databases, users or roles. It only manages the overlying cluster. Databases can however be bootstrapped from external sources. This is usually a bit easier when CNPG is set up to be a "microservice"
Backups/restore
CNPG has it's own CRD resources which can be used to backup/restore. It supports S3. Check the CNPG doc for instructions.
Updates
Updates of the databases can be handled by CNPG with a rolling update which are unsupervised (CNPG does update of primary when all others have been updated), or supervised (manual intervention to update primary).
Mariadb
Mariadb is managed through the official mariadb operator. To enable clustering/high availability, the Mariadb operator uses an auxillery system called Galera which is responsible for syncronising data and deciding on which instance is for example the primary/failover/replica. Galera has some limitations however, which has to be taken into consideration.
Mariadb can be used either standalone, or be shared between several applications.
Adding new databases, users and roles
The mariadb operator has CRD manifests that can manage the databases, users and roles. This has to be used if backups/restores are to work with Galera/clusters, more information about it can be found on: https://github.com/mariadb-operator/mariadb-operator/blob/main/docs/BACKUP.md#galera-backup-limitations
Backups/Restore
The mariadb operator has it's own CRD resources which can be used to do backups and restorations to/from PVCs, S3 etc. S3 is recommended. Check the Mariadb operator documentation for instructions. Be aware of the Galera limitations as described above. If a database is managed through i.e adminer, doing a restore from a backup will most likely cause a deduplication issue related to users and roles.
Mariadb also supports doing a backup of all database instances in a cluster and then doing restoration on all of them or on a selection databases.