Logical MongoDB Backup

If it hasn't been done already, the bitnami Helm repository needs to be added to your local configuration:

# Add bitnami helm repo
$ helm repo add bitnami https://charts.bitnami.com/bitnami

Install the MongoDB chart from the bitnami Helm repository:

$ kubectl create namespace mongodb-logical
$ helm install mongo-logical bitnami/mongodb --namespace mongodb-logical \
    --set architecture="replicaset"

To create a Blueprint resource, please run the command below:

 $ curl https://raw.githubusercontent.com/kanisterio/kanister/0.69.0/examples/stable/mongodb/blueprint-v2/mongo-blueprint.yaml > mongo-blueprint.yaml
 $ kubectl apply -f mongo-blueprint.yaml --namespace kasten-io


If MongoDB chart is installed specifying existing secret by setting parameter --set auth.existingSecret=<mongo-secret-name>, secret name in the blueprint mongo-blueprint.yaml needs to be modified at following places:

actions.backup.phases[0].objects.mongosecret.name: <mongo-secret-name> actions.restore.phases[0].objects.mongosecret.name: <mongo-secret-name>

Once the Blueprint is created, we will have to annotate the StatefulSet with the correct annotation to instruct K10 to use the Blueprint while performing operations on this MongoDB instance. The following example demonstrates how to annotate the MongoDB StatefulSet with the mongodb-logical Blueprint.

$ kubectl annotate statefulset mongo-logical-mongodb kanister.kasten.io/blueprint='mongodb-blueprint' \

Finally, use K10 to backup and restore the application.