We use cookies and other similar technology to collect data to improve your experience on our site, as described in our Privacy Policy.
Run Production-Grade Databases on Kubernetes
Backup and Recovery Solution for Kubernetes
Run Production-Grade Vault on Kubernetes
Secure HAProxy Ingress Controller for Kubernetes
Kubernetes Configuration Syncer
Kubernetes Authentication WebHook Server
KubeDB simplifies Provision, Upgrade, Scaling, Volume Expansion, Monitor, Backup, Restore for various Databases in Kubernetes on any Public & Private Cloud
A complete Kubernetes native disaster recovery solution for backup and restore your volumes and databases in Kubernetes on any public and private clouds.
KubeVault is a Git-Ops ready, production-grade solution for deploying and configuring Hashicorp's Vault on Kubernetes.
Secure HAProxy Ingress Controller for Kubernetes
Kubernetes Configuration Syncer
Kubernetes Authentication WebHook Server
New to KubeDB? Please start here.
MongoDBDatabase is a Kubernetes Custom Resource Definitions (CRD). It provides a declarative way of implementing multitenancy inside KubeDB provisioned MongoDB server. You need to describe the target database, desired database configuration, the vault server reference for managing the user in a MongoDBDatabase object, and the KubeDB Schema Manager operator will create Kubernetes objects in the desired state for you.
As with all other Kubernetes objects, an MongoDBDatabase needs apiVersion, kind, and metadata fields. It also needs a spec section.
apiVersion: schema.kubedb.com/v1alpha1
kind: MongoDBDatabase
metadata:
name: demo-schema
namespace: demo
spec:
database:
serverRef:
name: mongodb-server
namespace: dev
config:
name: myDB
vaultRef:
name: vault
namespace: dev
accessPolicy:
subjects:
- kind: ServiceAccount
name: "tester"
namespace: "demo"
defaultTTL: "10m"
maxTTL: "200h"
init:
initialized: false
snapshot:
repository:
name: repository
namespace: demo
script:
scriptPath: "etc/config"
configMap:
name: scripter
podTemplate:
spec:
containers:
- env:
- name: "HAVE_A_TRY"
value: "whoo! It works"
name: cnt
image: nginx
command:
- /bin/sh
- -c
args:
- ls
deletionPolicy: "Delete"
spec.database is a required field specifying the database server reference and the desired database configuration. You need to specify the following fields in spec.database,
serverRef refers to the mongodb instance where the particular schema will be applied.config defines the initial configuration of the desired database.KubeDB accepts the following fields to set in spec.database:
serverRef:
config:
spec.vaultRef is a required field that specifies which KubeVault server to use for user management. You need to specify the following fields in spec.vaultRef,
name specifies the name of the Vault server.namespace refers to the namespace where the Vault server is running.spec.accessPolicy is a required field that specifies the access permissions like which service account or cluster user have the access and for how long they can access through it. You need to specify the following fields in spec.accessPolicy,
subjects refers to the user or service account which is allowed to access the credentials.defaultTTL specifies for how long the credential would be valid.maxTTL specifies the maximum time-to-live for the credentials associated with this role.KubeDB accepts the following fields to set in spec.accessPolicy:
subjects:
defaultTTL
maxTTL
spec.init is an optional field, containing the information of a script or a snapshot using which the database should be initialized during creation. You can only specify either script or snapshot fields in spec.init,
script refers to the information regarding the .js file which should be used for initialization.snapshot carries information about the repository and snapshot_id to initialize the database by restoring the snapshot.KubeDB accepts the following fields to set in spec.init:
script:
scriptPath accepts a directory location at which the operator should mount the .js file.volumeSource can be secret, configmap, emptyDir, nfs, persistantVolumeClaim, hostPath etc. The referred volume source should carry the .js file in it.podTemplate specifies pod-related details, like environment variables, arguments, images etc.snapshot:
repository refers to the repository cr which carries necessary information about the snapshot location .snapshotId refers to the specific snapshot which should be restored .spec.deletionPolicy is an optional field that gives flexibility whether to nullify (reject) the delete operation.