You are looking at the documentation of a prior release. To read the documentation of the latest release, please visit here.

Backup and Restore Qdrant database using KubeStash

KubeStash allows you to backup and restore Qdrant databases. This guide will show you how to take logical backup and restore your Qdrant databases using Kubestash.

Before You Begin

  • At first, you need to have a Kubernetes cluster, and the kubectl command-line tool must be configured to communicate with your cluster. If you do not already have a cluster, you can create one by using Minikube or Kind.
  • Install KubeDB in your cluster following the steps here.
  • Install KubeStash in your cluster following the steps here.
  • Install KubeStash kubectl plugin following the steps here.
  • If you are not familiar with how KubeStash backup and restore Qdrant databases, please check the following guide here.

You should be familiar with the following KubeStash concepts:

To keep everything isolated, we are going to use a separate namespace called demo throughout this tutorial.

$ kubectl create ns demo
namespace/demo created

Note: YAML files used in this tutorial are stored in docs/examples/qdrant/backup/logical directory of kubedb/docs repository.

Backup Qdrant

KubeStash supports logical backup for Qdrant databases. In this demonstration, we’ll backup a Qdrant database into a S3-compatible storage (MinIO).

This section will demonstrate how to backup a Qdrant database. Here, we are going to deploy a Qdrant database using KubeDB. Then, we are going to backup this database into a MinIO bucket. Finally, we are going to restore the backed up data into another Qdrant database.

Deploy Sample Qdrant Database

Let’s deploy a sample Qdrant database and insert some data into it.

Create Qdrant CR:

Below is the YAML of a sample Qdrant CRD that we are going to create for this tutorial:

apiVersion: kubedb.com/v1alpha2
kind: Qdrant
metadata:
  name: qdrant-sample
  namespace: demo
spec:
  version: "1.17.0"
  mode: Distributed
  replicas: 3
  storage:
    storageClassName: standard
    accessModes:
      - ReadWriteOnce
    resources:
      requests:
        storage: 2Gi
  deletionPolicy: WipeOut

Create the above Qdrant CR,

$ kubectl apply -f https://github.com/kubedb/docs/raw/v2026.6.5-rc.1/docs/examples/qdrant/backup/logical/qdrant.yaml
qdrant.kubedb.com/qdrant-sample created

KubeDB will deploy a Qdrant database according to the above specification. It will also create the necessary Secrets and Services to access the database.

Let’s check if the database is ready to use,

$ kubectl get qdrant -n demo
NAME            VERSION   STATUS    AGE
qdrant-sample   1.17.0    Ready     4m22s

The database is Ready. Verify that KubeDB has created a Secret and a Service for this database using the following commands,

$ kubectl get secret -n demo -l=app.kubernetes.io/instance=qdrant-sample
NAME                  TYPE     DATA   AGE
qdrant-sample-auth    Opaque   2      4m58s

$ kubectl get service -n demo -l=app.kubernetes.io/instance=qdrant-sample
NAME                  TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)    AGE
qdrant-sample         ClusterIP   10.96.55.61      <none>        6333/TCP   97s
qdrant-sample-pods    ClusterIP   None             <none>        6333/TCP   97s

KubeDB creates an AppBinding CR that holds the necessary information to connect with the database.

Verify AppBinding:

Verify that the AppBinding has been created successfully using the following command,

$ kubectl get appbindings -n demo
NAME            AGE
qdrant-sample   9m24s

Let’s check the YAML of the above AppBinding,

$ kubectl get appbindings -n demo qdrant-sample -o yaml
apiVersion: appcatalog.appscode.com/v1alpha1
kind: AppBinding
metadata:
  labels:
    app.kubernetes.io/component: database
    app.kubernetes.io/instance: qdrant-sample
    app.kubernetes.io/managed-by: kubedb.com
    app.kubernetes.io/name: qdrants.kubedb.com
  name: qdrant-sample
  namespace: demo
  ownerReferences:
  - apiVersion: kubedb.com/v1alpha2
    blockOwnerDeletion: true
    controller: true
    kind: Qdrant
    name: qdrant-sample
    uid: edde3e8b-7775-4f91-85a9-4ba4b96315f7
  resourceVersion: "5126"
  uid: 86c9a149-f8ab-44c4-947f-5f9b402aad6c
spec:
  appRef:
    apiGroup: kubedb.com
    kind: Qdrant
    name: qdrant-sample
    namespace: demo
  clientConfig:
    service:
      name: qdrant-sample
      path: /
      port: 6333
      scheme: http
    url: http(qdrant-sample.demo.svc:6333)/
    ...
    ...
  secret:
    name: qdrant-sample-auth
  type: kubedb.com/qdrant
  version: 1.17.0

KubeStash uses the AppBinding CR to connect with the target database. It requires the following two fields to set in AppBinding’s .spec section.

  • .spec.clientConfig.service.name specifies the name of the Service that connects to the database.
  • .spec.secret specifies the name of the Secret that holds necessary credentials to access the database.
  • spec.type specifies the types of the app that this AppBinding is pointing to. KubeDB generated AppBinding follows the following format: <app group>/<app resource type>.

Insert Sample Data:

Now, let’s get the API key and port-forward to create a collection with sample data:

# Get the API key from the auth secret
$ export API_KEY=$(kubectl get secret -n demo qdrant-sample-auth -o jsonpath='{.data.api-key}' | base64 -d)

# Port-forward to the Qdrant service
$ kubectl port-forward -n demo svc/qdrant-sample 6333:6333 &
# Create a collection
$ curl -X PUT 'http://localhost:6333/collections/demo_collection' \
  -H "api-key: $API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"vectors": {"size": 4, "distance": "Cosine"}}'
# Insert points
$ curl -X PUT 'http://localhost:6333/collections/demo_collection/points' \
  -H "api-key: $API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "points": [
      { "id": 1, "vector": [0.1, 0.2, 0.3, 0.4], "payload": {"label": "a"} },
      { "id": 2, "vector": [0.5, 0.6, 0.7, 0.8], "payload": {"label": "b"} }
    ]
  }'

Now, we are ready to backup the database.

Prepare Backend

We are going to store our backed up data into a MinIO bucket. We have to create a Secret with necessary credentials and a BackupStorage CR to use this backend. If you want to use a different backend, please read the respective backend configuration doc from here.

Create Secret:

Let’s create a secret called storage-secret with access credentials to our desired MinIO backend,

$ kubectl create secret generic -n demo storage-secret \
    --from-literal=AWS_ACCESS_KEY_ID=minioadmin \
    --from-literal=AWS_SECRET_ACCESS_KEY=minioadmin
secret/storage-secret created

Create BackupStorage:

Now, create a BackupStorage using this secret. Below is the YAML of BackupStorage CR we are going to create,

apiVersion: storage.kubestash.com/v1alpha1
kind: BackupStorage
metadata:
  name: minio-storage
  namespace: demo
spec:
  storage:
    provider: s3
    s3:
      bucket: qdrant-backups
      endpoint: http://minio.demo.svc:9000
      insecureTLS: true
      prefix: backup/demo
      region: us-east-1
      secretName: storage-secret
  usagePolicy:
    allowedNamespaces:
      from: All
  default: true
  deletionPolicy: Delete

Let’s create the BackupStorage we have shown above,

$ kubectl apply -f https://github.com/kubedb/docs/raw/v2026.6.5-rc.1/docs/examples/qdrant/backup/logical/backup-storage.yaml
backupstorage.storage.kubestash.com/minio-storage created

Now, we are ready to backup our database to our desired backend.

Create RetentionPolicy:

Now, let’s create a RetentionPolicy to specify how the old Snapshots should be cleaned up.

Below is the YAML of the RetentionPolicy object that we are going to create,

apiVersion: storage.kubestash.com/v1alpha1
kind: RetentionPolicy
metadata:
  name: demo-retention
  namespace: demo
spec:
  default: true
  successfulSnapshots:
    last: 5
  usagePolicy:
    allowedNamespaces:
      from: All

Let’s create the above RetentionPolicy,

$ kubectl apply -f https://github.com/kubedb/docs/raw/v2026.6.5-rc.1/docs/examples/qdrant/backup/logical/retention-policy.yaml
retentionpolicy.storage.kubestash.com/demo-retention created

Backup

We have to create a BackupConfiguration targeting respective qdrant-sample Qdrant database. Then, KubeStash will create a CronJob for each session to take periodic backup of that database.

At first, we need to create a secret with a Restic password for backup data encryption.

Create Secret:

Let’s create a secret called encrypt-secret with the Restic password,

$ echo -n 'changeit' > RESTIC_PASSWORD
$ kubectl create secret generic -n demo encrypt-secret \
    --from-file=./RESTIC_PASSWORD
secret "encrypt-secret" created

Create BackupConfiguration:

Below is the YAML for BackupConfiguration CR to backup the qdrant-sample database that we have deployed earlier,

apiVersion: core.kubestash.com/v1alpha1
kind: BackupConfiguration
metadata:
  name: qdrant-sample-backup
  namespace: demo
spec:
  target:
    apiGroup: kubedb.com
    kind: Qdrant
    namespace: demo
    name: qdrant-sample
  backends:
    - name: minio-backend
      storageRef:
        namespace: demo
        name: minio-storage
      retentionPolicy:
        name: demo-retention
        namespace: demo
  sessions:
    - name: frequent-backup
      scheduler:
        schedule: "*/5 * * * *"
        jobTemplate:
          backoffLimit: 1
      repositories:
        - name: minio-qdrant-repo
          backend: minio-backend
          directory: /qdrant
          encryptionSecret:
            name: encrypt-secret
            namespace: demo
      addon:
        name: qdrant-addon
        tasks:
          - name: logical-backup
            params:
              collections: "demo_collection"
  • .spec.sessions[*].schedule specifies that we want to backup the database at 5 minutes interval.
  • .spec.target refers to the targeted qdrant-sample Qdrant database that we created earlier.
  • .spec.sessions[*].addon.tasks[*].params.collections specifies the name of the collection to backup. Multiple collections can be specified as a comma-separated list (e.g., "col1,col2").

Let’s create the BackupConfiguration CR that we have shown above,

$ kubectl apply -f https://github.com/kubedb/docs/raw/v2026.6.5-rc.1/docs/examples/qdrant/backup/logical/backup-configuration.yaml
backupconfiguration.core.kubestash.com/qdrant-sample-backup created

Verify Backup Setup Successful

If everything goes well, the phase of the BackupConfiguration should be Ready. The Ready phase indicates that the backup setup is successful. Let’s verify the Phase of the BackupConfiguration,

$ kubectl get backupconfiguration -n demo
NAME                    PHASE   PAUSED   AGE
qdrant-sample-backup    Ready            54s

Additionally, we can verify that the Repository specified in the BackupConfiguration has been created using the following command,

$ kubectl get repo -n demo
NAME                INTEGRITY   SNAPSHOT-COUNT   SIZE        PHASE   LAST-SUCCESSFUL-BACKUP   AGE
minio-qdrant-repo   true        3                8.613 KiB   Ready   48s                      58s

Verify CronJob:

It will also create a CronJob with the schedule specified in spec.sessions[*].scheduler.schedule field of BackupConfiguration CR.

Verify that the CronJob has been created using the following command,

$ kubectl get cronjob -n demo
NAME                                           SCHEDULE      TIMEZONE   SUSPEND   ACTIVE   LAST SCHEDULE   AGE
trigger-qdrant-sample-backup-frequent-backup   */5 * * * *   <none>     False     0        <none>          51s

Verify BackupSession:

KubeStash triggers an instant backup as soon as the BackupConfiguration is ready. After that, backups are scheduled according to the specified schedule.

$ kubectl get backupsession -n demo -w

NAME                                              INVOKER-TYPE          INVOKER-NAME           PHASE       DURATION   AGE
qdrant-sample-backup-frequent-backup-1779330454   BackupConfiguration   qdrant-sample-backup   Succeeded   7s         51s

We can see from the above output that the backup session has succeeded. Now, we are going to verify whether the backed up data has been stored in the backend.

Verify Backup:

Once a backup is complete, KubeStash will update the respective Repository CR to reflect the backup. Check that the repository minio-qdrant-repo has been updated by the following command,

$ kubectl get repository -n demo minio-qdrant-repo
NAME                INTEGRITY   SNAPSHOT-COUNT   SIZE        PHASE   LAST-SUCCESSFUL-BACKUP   AGE
minio-qdrant-repo   true        3                8.613 KiB   Ready   48s                      58s

Run the following command to check the respective Snapshot which represents the state of a backup run for an application.

$ kubectl get snapshots.storage.kubestash.com -n demo -l=kubestash.com/repo-name=minio-qdrant-repo
NAME                                                                              REPOSITORY          SESSION           SNAPSHOT-TIME          DELETION-POLICY   PHASE       AGE
minio-qdrant-repo-qdrant-sample-ckup-frequent-backup-1779330454                 minio-qdrant-repo   frequent-backup   2026-05-21T02:27:44Z   Delete            Succeeded   51s

Note: KubeStash creates a Snapshot with the following labels:

  • kubestash.com/app-ref-kind: <target-kind>
  • kubestash.com/app-ref-name: <target-name>
  • kubestash.com/app-ref-namespace: <target-namespace>
  • kubestash.com/repo-name: <repository-name>

These labels can be used to watch only the Snapshots related to our target Database or Repository.

KubeStash uses qdrant-restic-plugin to perform backups of target Qdrant databases. Therefore, the component name for logical backups is set as dump.

Restore

In this section, we are going to restore the database from the backup we have taken in the previous section. We are going to deploy a new database and initialize it from the backup.

Deploy Restored Database:

Now, we have to deploy the restored database similarly as we have deployed the original qdrant-sample database.

Below is the YAML for Qdrant CRD we are going deploy to initialize from backup,

apiVersion: kubedb.com/v1alpha2
kind: Qdrant
metadata:
  name: qdrant-sample-restore
  namespace: demo
spec:
  version: "1.17.0"
  mode: Distributed
  replicas: 3
  storage:
    storageClassName: standard
    accessModes:
      - ReadWriteOnce
    resources:
      requests:
        storage: 2Gi
  deletionPolicy: WipeOut

Let’s create the above database,

$ kubectl apply -f https://github.com/kubedb/docs/raw/v2026.6.5-rc.1/docs/examples/qdrant/backup/logical/qdrant-restore.yaml
qdrant.kubedb.com/qdrant-sample-restore created

Check the database status,

$ kubectl get qdrant -n demo qdrant-sample-restore
NAME              VERSION   STATUS   AGE
qdrant-sample-restore   1.17.0    Ready    48s

Create RestoreSession:

Now, we need to create a RestoreSession CRD pointing to targeted Qdrant database.

Below, is the contents of YAML file of the RestoreSession object that we are going to create to restore backed up data into the newly created database provisioned by Qdrant object named qdrant-sample-restore.

apiVersion: core.kubestash.com/v1alpha1
kind: RestoreSession
metadata:
  name: restore-qdrant-sample
  namespace: demo
spec:
  target:
    apiGroup: kubedb.com
    kind: Qdrant
    namespace: demo
    name: qdrant-sample-restore
  dataSource:
    repository: minio-qdrant-repo
    snapshot: latest
    encryptionSecret:
      name: encrypt-secret
      namespace: demo
  addon:
    name: qdrant-addon
    tasks:
      - name: logical-backup-restore

Here,

  • .spec.target refers to the newly created qdrant-sample-restore Qdrant object to where we want to restore backup data.
  • .spec.dataSource.repository specifies the Repository object that holds the backed up data.
  • .spec.dataSource.snapshot specifies to restore from latest Snapshot.

Let’s create the RestoreSession CRD object we have shown above,

$ kubectl apply -f https://github.com/kubedb/docs/raw/v2026.6.5-rc.1/docs/examples/qdrant/backup/logical/restore-session.yaml
restoresession.core.kubestash.com/restore-qdrant-sample created

Once, you have created the RestoreSession object, KubeStash will create restore Job. Run the following command to watch the phase of the RestoreSession object,

$ kubectl get restoresession -n demo -w

NAME                    REPOSITORY          PHASE    DURATION   AGE
restore-qdrant-sample   minio-qdrant-repo   Succeeded   3s         53s

Now, let’s verify the restored data.

Verify Restored Data:

In this section, we are going to verify whether the desired data has been restored successfully. We are going to connect to the database server and check whether the collection we created earlier in the original database are restored.

At first, check if the database has gone into Ready state by the following command,

$ kubectl get qdrant -n demo qdrant-sample-restore
NAME               VERSION   STATUS  AGE
qdrant-sample-restore    1.17.0    Ready   34m

Now, find out the database Pod by the following command,

$ kubectl get pods -n demo --selector="app.kubernetes.io/instance=qdrant-sample-restore"
NAME                READY   STATUS    RESTARTS   AGE
qdrant-sample-restore-0   1/1     Running   0          39m

Now, let’s get the API key and port-forward to verify the restored data,

# Get the API key from the restored auth secret
$ export API_KEY=$(kubectl get secret -n demo qdrant-sample-restore-auth -o jsonpath='{.data.api-key}' | base64 -d)

$ kubectl port-forward -n demo svc/qdrant-sample-restore 6333:6333 &
# Scroll points to verify the restored data
$ curl -X POST 'http://localhost:6333/collections/demo_collection/points/scroll' \
  -H "api-key: $API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"limit": 10, "with_payload": true, "with_vector": true}'
{
  "result": {
    "points": [
      {
        "id": 1,
        "payload": {"label": "a"},
        "vector": [0.18257418, 0.36514837, 0.5477226, 0.73029673]
      },
      {
        "id": 2,
        "payload": {"label": "b"},
        "vector": [0.37904903, 0.45485884, 0.5306686, 0.60647845]
      }
    ],
    "next_page_offset": null
  },
  "status": "ok",
  "time": 0.000710068
}

So, from the above output, we can see that the demo_collection we created earlier in the original database is now restored successfully.

Cleanup

To cleanup the Kubernetes resources created by this tutorial, run:

kubectl delete backupconfiguration.core.kubestash.com -n demo qdrant-sample-backup
kubectl delete restoresession.core.kubestash.com -n demo restore-qdrant-sample
kubectl delete retentionpolicy.storage.kubestash.com -n demo demo-retention
kubectl delete backupstorage -n demo minio-storage
kubectl delete secret -n demo storage-secret
kubectl delete secret -n demo encrypt-secret
kubectl delete qdrant -n demo qdrant-sample-restore
kubectl delete qdrant -n demo qdrant-sample