> For the complete documentation index, see [llms.txt](https://docs.cennso.com/cennso/cennso-db/latest/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/cennso/cennso-db/latest.md).

# Introduction

The Cennso Database (Cennso DB) extension provides resources to bootstrap, configure, and manage MySQL and PostgreSQL database clusters.

Thanks to the bundled database operators, the Cennso Database extension allows you to handle various database operations, such as provisioning and deprovisioning database clusters, scaling, creation of backups, managing TLS certificates, and others.

The Cennso Database extension keeps every database cluster deployment aligned with cluster-wide policies for storage classes, access controls, and secret management, so the database inherits your namespace-level RBAC and logging/backup retention rules. As this extension is aligned with the Cennso extension model, you can provision and manage database clusters in a declarative way alongside other Cennso workloads through [Crossplane](https://www.crossplane.io/) compositions.

This extension allows you to easily set up a database instance or a cluster of database instances for any Cennso-based service that must retain state. Use it for transactional workloads like subscriber metadata or billing, for analytics that demand ACID guarantees, or to preserve configuration and lifecycle data that must survive pod restarts.

This extension exposes the following high-level resources to deploy and manage MySQL clusters:

| Resource | Description |
|---|---|
| [`DBOperator`](https://docs.cennso.com/cennso/cennso-db/latest/concepts/cennso-db-operator.md) | Deploys the MySQL operator |
| [`DBInstance`](https://docs.cennso.com/cennso/cennso-db/latest/concepts/cennso-db-instance.md) | Deploys and configures MySQL instances |
| [`DBBackup`](https://docs.cennso.com/cennso/cennso-db/latest/concepts/cennso-db-backup.md) | Manages backups of MySQL databases |
| [`DBTLSCertificate`](https://docs.cennso.com/cennso/cennso-db/latest/concepts/cennso-db-certificate.md) | Manages TLS certificates for MySQL instances |
| [`DBSchema`](https://docs.cennso.com/cennso/cennso-db/latest/concepts/cennso-db-schema.md) | Manages logical databases in MySQL clusters |
| [`DBUser`](https://docs.cennso.com/cennso/cennso-db/latest/concepts/cennso-db-users.md) | Manages MySQL users and their privileges |

This extension exposes the following high-level resources to deploy and manage PostgreSQL clusters:

| Resource | Description |
|---|---|
| [`PostgreSQLOperator`](https://docs.cennso.com/cennso/cennso-db/latest/concepts/cennso-postgresql-operator.md) | Deploys the PostgreSQL operator |
| [`PostgreSQLInstance`](https://docs.cennso.com/cennso/cennso-db/latest/concepts/cennso-postgresql-instance.md) | Deploys and configures PostgreSQL instances |
| [`PostgreSQLBackup`](https://docs.cennso.com/cennso/cennso-db/latest/concepts/cennso-postgresql-backup.md) | Manages backups of PostgreSQL databases |
| [`PostgreSQLSchema`](https://docs.cennso.com/cennso/cennso-db/latest/concepts/cennso-postgresql-schema.md) | Manages logical databases in PostgreSQL clusters |
| [`PostgreSQLUser`](https://docs.cennso.com/cennso/cennso-db/latest/concepts/cennso-postgresql-user.md) | Manages PostgreSQL users and their privileges |

To get started, read the following documents:

- [Installation](https://docs.cennso.com/cennso/cennso-db/latest/installation.md) - install the Cennso Database extension
- [Deploy Cennso Database](https://docs.cennso.com/cennso/cennso-db/latest/deployment-guides/cennso-database.md) - deploy a MySQL cluster
- [Deploy Cennso PostgreSQL](https://docs.cennso.com/cennso/cennso-db/latest/deployment-guides/cennso-postgresql.md) - deploy a PostgreSQL cluster

## Use cases

You can configure and deploy the Cennso Database extension for Cennso Network Solutions (CNS) or Cennso Network Functions (CNF) to store and manage the state.

The diagram below represents a typical database cluster deployed using the Cennso Database extension:

![Cennso Database deployment](https://docs.cennso.com/api/assets/cennso/cennso-db/latest/assets/images/cennso-database-diagram.svg)

On the diagram you may see a Cennso Network Solution cluster consisting of the three Cennso Network Function pods connected through a database proxy to the database cluster. The database cluster consists of two database instances managed by the database operator. The topology of the database cluster is managed by the failover manager.

## Container images

Each database cluster is built from a set of container images that the extension pins to tested default versions. A cluster deployed with no image settings runs MySQL 8.0 or PostgreSQL 18.

You can override every image in the related Custom Resource, for example to pull from your own registry or to run a different PostgreSQL major version.

In the sections below, you can find the list of the default images per database server.

### MySQL container images

The database operator and the MySQL instances use the following container images:

| Image | Description |
|---|---|
| `registry.cennso.com/cennso/percona-server-mysql-operator:0.9.0-tpaddons.3` | The database operator image |
| `registry.cennso.com/cennso/percona-server-mysql-bootstrap:0.9.0-cennso-0.2` | The init container image of the MySQL instances |
| `registry.cennso.com/cennso/mysql-server:v8.0.45-36` | The MySQL instances image |

### PostgreSQL container images

The database operator and the PostgreSQL instances use the following container images:

| Image | Description |
|---|---|
| `registry.cennso.com/cennso/postgresql-operator:v3.1.0` | The database operator image, also used as the init container image of the PostgreSQL instances |
| `registry.cennso.com/cennso/pg-db:v18.3-2` | The PostgreSQL instances image |

## Additional containers

In addition to the database operator and server container images, each database cluster uses additional containers. Their set depends on the database server of your choice. The following sections describe the additional containers you can deploy together with the database operator and instances.

### MySQL additional containers

For the MySQL cluster, you can deploy the following additional containers:

- [HAProxy](https://www.haproxy.org/)
- [MySQL Orchestrator](https://github.com/openark/orchestrator)
- [Percona Toolkit](https://www.percona.com/percona-toolkit)
- [Percona XtraBackup](https://docs.percona.com/percona-xtrabackup/8.4/) with [Restic](https://restic.net/) client

HAProxy provides an endpoint for the MySQL cluster, pooling connections across the operator-managed pods and gracefully draining traffic before rolling upgrades. Clients can point to the HAProxy service without caring which replica is writable, while the proxy keeps TCP sessions alive.

MySQL Orchestrator keeps a live representation of the replication topologies of the MySQL clusters, detects replication lag or node failures, and automates promotion of the healthiest replica when the primary goes down.

Percona Toolkit runs as a sidecar of each MySQL instance and ships the `pt-*` command-line tools for diagnosing and maintaining the MySQL cluster, such as checking replication consistency or analyzing slow queries. The same image runs a second sidecar that applies the primary or replica role settings to the MySQL instance whenever its role changes.

Percona XtraBackup takes physical backups of a running MySQL instance without blocking it, and the Restic client uploads them as encrypted, deduplicated snapshots to a Restic repository. The combined image runs as a sidecar of each MySQL instance, and the backup jobs created by the `DBBackup` Custom Resource execute the backup inside the sidecar of a read replica.

The additional components use the following container images:

| Image | Description |
|---|---|
| `registry.cennso.com/cennso/haproxy:v2.8.14` | The HAProxy sidecar that exposes the MySQL cluster endpoint |
| `registry.cennso.com/cennso/mysql-orchestrator:v3.2.6-19-cennso-0.3` | The MySQL Orchestrator image |
| `registry.cennso.com/cennso/percona-toolkit:v3.7.1` | The Percona Toolkit sidecar of each MySQL instance, also used to apply the primary or replica role settings |
| `registry.cennso.com/cennso/xtrabackup-restic:v8.0.35-35.3` | The Percona XtraBackup with Restic sidecar of each MySQL instance that performs the backups |

The following container images are deployed only for the related Custom Resources and configuration options:

| Image | Description |
|---|---|
| `registry.cennso.com/cennso/binlog-donor:v1.0.1` | The `binary-donor` application that can be enabled with **spec.binaryDonor.enabled** |
| `registry.cennso.com/cennso/mysql-server-client:v8.0.0` | The database client for the schemas and users provisioning jobs |
| `registry.cennso.com/cennso/alpine-kubectl:v1.35.0` | The `kubectl` client for the `DBBackup` jobs that runs the backup inside the XtraBackup sidecar |
| `registry.cennso.com/cennso/percona-mysqld-exporter:v3.6.0-cennso-1.0.0` | The metrics exporter sidecar of each MySQL instance that can be enabled with **spec.metricsExporter.enabled** |

### PostgreSQL additional containers

For the PostgreSQL cluster, you can deploy the following additional containers:

- [PgBouncer](https://www.pgbouncer.org/)
- [Percona Distribution for PostgreSQL](https://www.percona.com/postgresql/software/postgresql-distribution) client tools with [Restic](https://restic.net/) client
- [pg_upgrade](https://www.postgresql.org/docs/current/pgupgrade.html) with [pgBackRest](https://pgbackrest.org/)

PgBouncer provides an endpoint for the PostgreSQL cluster. It pools and limits the number of active PostgreSQL connections and routes clients to the current primary. Clients can point to the PgBouncer service without knowing which pod is writable.

Failover is handled by [Patroni](https://docs.cennso.com/cennso/cennso-db/latest/troubleshooting/patroni.md), which runs inside the PostgreSQL server image rather than as a separate container. It keeps the replication topology of the PostgreSQL cluster, detects node failures, and promotes the healthiest replica when the primary goes down.

The additional components use the following container images:

| Image | Description |
|---|---|
| `registry.cennso.com/cennso/pgbouncer:v1.25.1-1` | The PgBouncer image that exposes the PostgreSQL cluster endpoint |
| `registry.cennso.com/cennso/pg-basebackup-restic:v18.3-2-cennso-0.2` | The `pg_basebackup` with Restic image used by the backup jobs |

The following container images are deployed only for the related Custom Resources and configuration options:

| Image | Description |
|---|---|
| `registry.cennso.com/cennso/pg-db:v18.3-2` | The database client for the schemas and users provisioning jobs |
| `registry.cennso.com/cennso/postgresql-upgrade:v18.6-17.11-16.15-15.19-14.24-1` | The `pg_upgrade` job image for several PostgreSQL major versions, deployed only during an in-place major-version upgrade |
| `registry.cennso.com/cennso/pgbackrest:2.59.1-1` | The pgBackRest image used only by the upgrade job |
| `registry.cennso.com/cennso/percona-postgres-exporter:v3.10.0-cennso-0.0.1` | The metrics exporter of each PostgreSQL pod, enabled by default with **spec.metricsExporter.enabled** |
