You are looking at the documentation of a prior release. To read the documentation of the latest release, please
visit here.
New to KubeDB? Please start here.
Before You Begin
- You should be familiar with the following
KubeDBconcepts:
What is Schema Manager
Schema Manager is a Kubernetes operator developed by AppsCode that implements multi-tenancy inside KubeDB provisioned database servers like MySQL, MariaDB, PosgreSQL and MongoDB etc. With Schema Manager one can create database into specific database server. An user will also be created with KubeVault and assigned to that database. Using the newly created user credential one can access the database and run operations into it. One may pass the database server reference, configuration, user access policy through a single yaml and Schema Manager will do all the task above mentioned. Schema Manager also allows initializing the database and restore snapshot while bootstrap.
How MongoDB Schema Manager Process Works
The following diagram shows how MongoDB Schema Manager process worked. Open the image in a new tab to see the enlarged version.
The process consists of the following steps:
At first the user will deploy a
MongoDBDatabaseobject.Once a
MongoDBDatabaseobject is deployed to the cluster, theSchema Manageroperator first verifies if it has the required permission to be able to interact with the referred database-server by checkingDouble-OptIn. After theDouble-OptInverificationSchema Manageroperator checks in theMongoDBserver if the target database is already present or not. If the database already present there, then theMongoDBDatabaseobject will be immediately denied.Once everything is ok in the
MongoDBserver side, then the target database will be created and an entry for that will be entered in thekubedb_systemdatabase.Then
Schema Manageroperator creates aMongoDB Role.Vaultoperator always watches for a DatabaseRole.Once
Vaultoperator finds a DatabaseRole, it creates aSecretfor thatRole.After this process, the
Vaultoperator creates aUserin theMongoDBserver. The user gets all the privileges on our target database and its credentials are served with theSecret. The user credentials secret reference is patched with theMongoDBDatabaseobject yaml in the.status.authSecret.namefield.If there is any
init scriptassociated with theMongoDBDatabaseobject, it will be executed in this step with theSchema Manageroperator.The user can also provide a
snapshotreference for initialization. In that caseSchema Manageroperator fetches necessaryappbinding,secrets,repository.Stashoperator watches for aRestoresession.Once
Stashoperator finds aRestoresession, it Restores the targeted database with theSnapshot.
In the next doc, we are going to show a step by step guide of using MongoDB Schema Manager with KubeDB.






























