External database
This feature is available in the vCluster Pro tier. Contact us for more details and to start a trial.
Introduction​
This guide explains how to configure an external database as the backing store for a virtual cluster. A backing store is a persistent storage solution that maintains the state and data of the virtual cluster. Using an external database can provide better performance, scalability, and data persistence compared to the default embedded storage.
Configure this feature to use an external database such as MySQL or PostgreSQL for your virtual cluster's backing store.
controlPlane:
backingStore:
database:
external:
enabled: true
dataSource: CONNECTION_STRING
connector: CONNECTOR_STRING
Connector and data source​
There are two mutually exclusive options for using an external backing store.
dataSource
: assign a connection string to dataSource
that the virtual cluster uses for its control plane backing store.
connector
: assign a name of a connector secret that exists in an instance of the platform in the installed namespace. The platform uses the secret to automatically provision a separate database within the database server for the virtual cluster. It also creates a non-privileged user that can only interact with the virtual cluster's database. The virtual cluster receives a connection string built from the user and database.
Connector | DataSource | |
---|---|---|
MySQL Support | Yes | Yes |
PostgreSQL Support | Not yet | Yes |
Share Across virtual clusters | Yes | No |
Automatic DB Cleanup | Yes | No |
Credential stored in secret | Yes | No |
Datasource configuration​
Replace CONNECTION_STRING
with the connection string for your database. Examples:
- PostgreSQL:
postgres://username:password@hostname:5432/vcluster-db
- MySQL:
mysql://root:password@tcp(192.168.86.9:30360)/vcluster
Changing the backing store of a virtual cluster after deployment is not supported.
Connector configuration​
An administrator must first set up a database connector secret in the platform. Your virtual cluster must have access to the platform.
Once the connector secret has been configured, assign the name of the secret to the connector
field.
Any virtual cluster can connect to the platform. This is usually done by configuring a platform API key. Connecting to the platform allows for centralized management and monitoring of virtual clusters, enhancing overall operational efficiency.
Config reference​
embedded
required object pro​
Embedded defines that an embedded database (sqlite) should be used as the backend for the virtual cluster
embedded
required object pro​enabled
required boolean false pro​
Enabled defines if the database should be used.
enabled
required boolean false pro​dataSource
required string pro​
DataSource is the kine dataSource to use for the database. This depends on the database format.
This is optional for the embedded database. Examples:
- mysql: mysql://username:password@tcp(hostname:3306)/k3s
- postgres: postgres://username:password@hostname:5432/k3s
dataSource
required string pro​keyFile
required string pro​
KeyFile is the key file to use for the database. This is optional.
keyFile
required string pro​certFile
required string pro​
CertFile is the cert file to use for the database. This is optional.
certFile
required string pro​caFile
required string pro​
CaFile is the ca file to use for the database. This is optional.
caFile
required string pro​