Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mongo kubestash backup doc rendering #673

Merged
merged 6 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,20 @@ In this tutorial, we are going to show how you can configure a backup blueprint

## 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.
- Install KubeStash Enterprise in your cluster following the steps [here](https://stash.run/docs/latest/setup/install/stash/).
- Install KubeDB in your cluster following the steps [here](/docs/setup/README.md).
- If you are not familiar with how Stash backup and restore MongoDB databases, please check the following guide [here](/docs/guides/mongodb/backup/stash/overview/index.md).
- If you are not familiar with how auto-backup works in Stash, please check the following guide [here](https://stash.run/docs/latest/guides/auto-backup/overview/).
- If you are not familiar with the available auto-backup options for databases in Stash, please check the following guide [here](https://stash.run/docs/latest/guides/auto-backup/database/).
- 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](/docs/setup/README.md).
- Install `KubeStash` in your cluster following the steps [here](https://kubestash.com/docs/latest/setup/install/kubestash).
- Install KubeStash `kubectl` plugin following the steps [here](https://kubestash.com/docs/latest/setup/install/kubectl-plugin/).
- If you are not familiar with how KubeStash backup and restore `MongoDB` databases, please check the following guide [here](/docs/guides/mongodb/backup/kubestash/overview/index.md).

You should be familiar with the following `KubeStash` concepts:

- [BackupBlueprint](https://stash.run/docs/latest/concepts/crds/backupblueprint/)
- [BackupConfiguration](https://stash.run/docs/latest/concepts/crds/backupconfiguration/)
- [BackupSession](https://stash.run/docs/latest/concepts/crds/backupsession/)
- [Repository](https://stash.run/docs/latest/concepts/crds/repository/)
- [Function](https://stash.run/docs/latest/concepts/crds/function/)
- [Task](https://stash.run/docs/latest/concepts/crds/task/)
- [BackupBlueprint](https://kubestash.com/docs/latest/concepts/crds/backupblueprint/)
- [BackupConfiguration](https://kubestash.com/docs/latest/concepts/crds/backupconfiguration/)
- [BackupSession](https://kubestash.com/docs/latest/concepts/crds/backupsession/)
- [BackupStorage](https://kubestash.com/docs/latest/concepts/crds/backupstorage/)
- [Function](https://kubestash.com/docs/latest/concepts/crds/function/)
- [Addon](https://kubestash.com/docs/latest/concepts/crds/addon/)

To keep things isolated, we are going to use a separate namespace called `demo` throughout this tutorial. Create `demo` namespace if you haven't created yet.

Expand All @@ -48,7 +47,7 @@ namespace/demo created

So we can also take backup any MongoDB database of any namespace just by adding few annotations to our MongoDB CRD. Then, KubeStash will automatically create a `BackupConfiguration` according to the template to backup the database.

We are going to store our backed up data into a S3 bucket. At first, we need to create a secret with S3 credentials then we need to create a `BackupStorage` crd. If you want to use a different backend, please read the respective backend configuration doc from [here](https://stash.run/docs/latest/guides/backends/overview/).
We are going to store our backed up data into a S3 bucket. At first, we need to create a secret with S3 credentials then we need to create a `BackupStorage` crd. If you want to use a different backend, please read the respective backend configuration doc from [here](https://kubestash.com/docs/latest/guides/backends/overview/).

### Create Storage Secret:

Expand Down Expand Up @@ -81,7 +80,7 @@ spec:
bucket: kubestash-testing
region: us-east-1
prefix: demo
secret: s3-secret
secretName: s3-secret
usagePolicy:
allowedNamespaces:
from: All
Expand Down Expand Up @@ -147,28 +146,30 @@ spec:
backupConfigurationTemplate:
deletionPolicy: OnDelete
backends:
- name: s3-backend
storageRef:
namespace: ${storageNamespace}
name: ${storageName}
retentionPolicy:
name: backup-rp
namespace: demo
- name: s3-backend
storageRef:
namespace: ${storageNamespace}
name: ${storageName}
retentionPolicy:
name: backup-rp
namespace: demo
sessions:
- name: frequent
scheduler:
schedule: ${scheduleTime}
repositories:
- name: ${repoName}
backend: s3-backend
directory: ${backupPath}
encryptionSecret:
name: encry-secret
namespace: demo
addon:
name: mongodb-addon
tasks:
- name: LogicalBackup
- name: frequent
scheduler:
jobTemplate:
backoffLimit: 1
schedule: ${scheduleTime}
repositories:
- name: ${repoName}
backend: s3-backend
directory: ${backupPath}
encryptionSecret:
name: encry-secret
namespace: demo
addon:
name: mongodb-addon
tasks:
- name: LogicalBackup
```

Here, we define a template for `BackupConfiguration`. Notice the `backends` and `sessions` fields of `backupConfigurationTemplate` section. We have used some variables in form of `${VARIABLE_NAME}`. KubeStash will automatically resolve those variables from the database annotations information to make `BackupConfiguration` according to that databases need.
Expand All @@ -180,7 +181,7 @@ Let's create the `BackupBlueprint` we have shown above,
backupblueprint.core.kubestash.com/sample-blueprint created
```

Now, we are ready to backup our MongoDB databases using few annotations. You can check available auto-backup annotations for a databases from [here](https://stash.run/docs/latest/guides/auto-backup/database/#available-auto-backup-annotations-for-database).
Now, we are ready to backup our `MongoDB` databases using few annotations.

### Create Database

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ spec:
name: mongodb-addon
tasks:
- name: LogicalBackupRestoress
jobTemplate:
spec:
securityContext:
runAsUser: 0
runAsGroup: 0
jobTemplate:
spec:
securityContext:
runAsUser: 0
runAsGroup: 0
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,20 @@ spec:
name: s3-storage
retentionPolicy:
name: backup-rp
namespace: demo
namespace: demo
sessions:
- name: frequent
scheduler:
schedule: "*/5 * * * *"
jobTemplate:
backoffLimit: 1
repositories:
- name: s3-repo
backend: s3-backend
directory: /mongodb
encryptionSecret:
name: encry-secret
namespace: demo
name: encry-secret
namespace: demo
addon:
name: mongodb-addon
tasks:
Expand Down Expand Up @@ -206,9 +208,7 @@ demo s3-repo-mg-frequent-1702291682 s3-repo frequent 2023-12-11T
demo s3-repo-mg-frequent-1702291685 s3-repo frequent 2023-12-11T10:49:10Z Delete Succeeded 82m
```

>You can also filter the snapshots as shown in the guide [here](https://stash.run/docs/latest/concepts/crds/snapshot/#working-with-snapshot).

The below example shows how you can pass a specific snapshot id through the `snapshots` filed of `rules` section.
The below example shows how you can pass a specific snapshot id through the `snapshots` filed of `spec.dataSource` section.

```yaml
apiVersion: core.kubestash.com/v1alpha1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spec:
bucket: kubestash-testing
region: us-east-1
prefix: demo-replicaset
secret: s3-secret
secretName: s3-secret
usagePolicy:
allowedNamespaces:
from: All
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ KubeStash v0.1.0+ supports backup and restoration of MongoDB databases. This gui

- 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.
- Install KubeDB in your cluster following the steps [here](/docs/setup/README.md).
- Install KubeStash Enterprise in your cluster following the steps [here(link needed)]().
- Install KubeStash `kubectl` plugin following the steps [here(link needed)]().
- If you are not familiar with how KubeStash backup and restore MongoDB databases, please check the following guide [here](/docs/guides/mongodb/backup/kubestash/overview/_index.md).
- Install KubeStash Enterprise in your cluster following the steps [here](https://kubestash.com/docs/latest/setup/install/kubestash/).
- Install KubeStash `kubectl` plugin following the steps [here](https://kubestash.com/docs/latest/setup/install/kubectl-plugin/).
- If you are not familiar with how KubeStash backup and restore MongoDB databases, please check the following guide [here](/docs/guides/mongodb/backup/kubestash/overview/index.md).

You have to be familiar with following custom resources:

- [AppBinding](/docs/guides/mongodb/concepts/appbinding.md)
- [Function](https://stash.run/docs/latest/concepts/crds/function/)
- [Task](https://stash.run/docs/latest/concepts/crds/task/)
- [BackupConfiguration](https://stash.run/docs/latest/concepts/crds/backupconfiguration/)
- [RestoreSession](https://stash.run/docs/latest/concepts/crds/restoresession/)
- [Function](https://kubestash.com/docs/latest/concepts/crds/function/)
- [Addon](https://kubestash.com/docs/latest/concepts/crds/addon/)
- [BackupConfiguration](https://kubestash.com/docs/latest/concepts/crds/backupconfiguration/)
- [RestoreSession](https://kubestash.com/docs/latest/concepts/crds/restoresession/)

To keep things isolated, we are going to use a separate namespace called `demo` throughout this tutorial. Create `demo` namespace if you haven't created yet.

Expand Down Expand Up @@ -169,7 +169,7 @@ Now, we are ready to backup this sample database.

### Prepare Backend

We are going to store our backed up data into a S3 bucket. At first, we need to create a secret with S3 credentials then we need to create a `BackupStorage` crd. If you want to use a different backend, please read the respective backend configuration doc from [here](https://stash.run/docs/latest/guides/backends/overview/).
We are going to store our backed up data into a S3 bucket. At first, we need to create a secret with S3 credentials then we need to create a `BackupStorage` crd. If you want to use a different backend, please read the respective backend configuration doc from [here](https://kubestash.com/docs/latest/guides/backends/overview/).

**Create Storage Secret:**

Expand Down Expand Up @@ -202,7 +202,7 @@ spec:
bucket: kubestash-testing
region: us-east-1
prefix: demo-replicaset
secret: s3-secret
secretName: s3-secret
usagePolicy:
allowedNamespaces:
from: All
Expand Down Expand Up @@ -283,18 +283,20 @@ spec:
name: s3-storage-replicaset
retentionPolicy:
name: backup-rp
namespace: demo
namespace: demo
sessions:
- name: frequent
scheduler:
jobTemplate:
backoffLimit: 1
schedule: "*/3 * * * *"
repositories:
- name: s3-repo
backend: s3-backend
directory: /replicaset
encryptionSecret:
name: encry-secret
namespace: demo
name: encry-secret
namespace: demo
addon:
name: mongodb-addon
tasks:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ KubeStash v0.1.0+ supports backup and restoration of MongoDB databases. This gui

- 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.
- Install KubeDB in your cluster following the steps [here](/docs/setup/README.md).
- Install KubeStash Enterprise in your cluster following the steps [here(link needed)]().
- Install KubeStash `kubectl` plugin following the steps [here(link needed)]().
- If you are not familiar with how KubeStash backup and restore MongoDB databases, please check the following guide [here](/docs/guides/mongodb/backup/kubestash/overview/_index.md).
- Install KubeStash Enterprise in your cluster following the steps [here](https://kubestash.com/docs/latest/setup/install/kubestash/).
- Install KubeStash `kubectl` plugin following the steps [here](https://kubestash.com/docs/latest/setup/install/kubectl-plugin/).
- If you are not familiar with how KubeStash backup and restore MongoDB databases, please check the following guide [here](/docs/guides/mongodb/backup/kubestash/overview/index.md).

You have to be familiar with following custom resources:

- [AppBinding](/docs/guides/mongodb/concepts/appbinding.md)
- [Function](https://stash.run/docs/latest/concepts/crds/function/)
- [Task](https://stash.run/docs/latest/concepts/crds/task/)
- [BackupConfiguration](https://stash.run/docs/latest/concepts/crds/backupconfiguration/)
- [RestoreSession](https://stash.run/docs/latest/concepts/crds/restoresession/)
- [Function](https://kubestash.com/docs/latest/concepts/crds/function/)
- [Addon](https://kubestash.com/docs/latest/concepts/crds/addon/)
- [BackupConfiguration](https://kubestash.com/docs/latest/concepts/crds/backupconfiguration/)
- [RestoreSession](https://kubestash.com/docs/latest/concepts/crds/restoresession/)

To keep things isolated, we are going to use a separate namespace called `demo` throughout this tutorial. Create `demo` namespace if you haven't created yet.

Expand Down Expand Up @@ -177,7 +177,7 @@ Now, we are ready to backup this sample database.

### Prepare Backend

We are going to store our backed up data into a S3 bucket. At first, we need to create a secret with S3 credentials then we need to create a `BackupStorage` crd. If you want to use a different backend, please read the respective backend configuration doc from [here](https://stash.run/docs/latest/guides/backends/overview/).
We are going to store our backed up data into a S3 bucket. At first, we need to create a secret with S3 credentials then we need to create a `BackupStorage` crd. If you want to use a different backend, please read the respective backend configuration doc from [here](https://kubestash.com/docs/latest/guides/backends/overview/).

**Create Storage Secret:**

Expand Down Expand Up @@ -210,7 +210,7 @@ spec:
bucket: kubestash-testing
region: us-east-1
prefix: demo-sharding
secret: s3-secret
secretName: s3-secret
usagePolicy:
allowedNamespaces:
from: All
Expand Down Expand Up @@ -291,18 +291,20 @@ spec:
name: s3-storage-sharding
retentionPolicy:
name: backup-rp
namespace: demo
namespace: demo
sessions:
- name: frequent
scheduler:
jobTemplate:
backoffLimit: 1
schedule: "*/3 * * * *"
repositories:
- name: s3-repo
backend: s3-backend
directory: /sharding
encryptionSecret:
name: encry-secret
namespace: demo
name: encry-secret
namespace: demo
addon:
name: mongodb-addon
tasks:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ KubeStash v0.1.0+ supports backup and restoration of MongoDB databases. This gui

- 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.
- Install KubeDB in your cluster following the steps [here](/docs/setup/README.md).
- Install KubeStash Enterprise in your cluster following the steps [here(link needed)]().
- Install KubeStash `kubectl` plugin following the steps [here(link needed)]().
- If you are not familiar with how KubeStash backup and restore MongoDB databases, please check the following guide [here](/docs/guides/mongodb/backup/kubestash/overview/_index.md).
- Install KubeStash Enterprise in your cluster following the steps [here](https://kubestash.com/docs/latest/setup/install/kubestash/).
- Install KubeStash `kubectl` plugin following the steps [here](https://kubestash.com/docs/latest/setup/install/kubectl-plugin/).
- If you are not familiar with how KubeStash backup and restore MongoDB databases, please check the following guide [here](/docs/guides/mongodb/backup/kubestash/overview/index.md).

You have to be familiar with following custom resources:

- [AppBinding](/docs/guides/mongodb/concepts/appbinding.md)
- [Function](https://stash.run/docs/latest/concepts/crds/function/)
- [Task](https://stash.run/docs/latest/concepts/crds/task/)
- [BackupConfiguration](https://stash.run/docs/latest/concepts/crds/backupconfiguration/)
- [RestoreSession](https://stash.run/docs/latest/concepts/crds/restoresession/)
- [Function](https://kubestash.com/docs/latest/concepts/crds/function/)
- [Addon](https://kubestash.com/docs/latest/concepts/crds/addon/)
- [BackupConfiguration](https://kubestash.com/docs/latest/concepts/crds/backupconfiguration/)
- [RestoreSession](https://kubestash.com/docs/latest/concepts/crds/restoresession/)

To keep things isolated, we are going to use a separate namespace called `demo` throughout this tutorial. Create `demo` namespace if you haven't created yet.

Expand Down Expand Up @@ -163,7 +163,7 @@ Now, we are ready to backup this sample database.

### Prepare Backend

We are going to store our backed up data into a S3 bucket. At first, we need to create a secret with S3 credentials then we need to create a `BackupStorage` crd. If you want to use a different backend, please read the respective backend configuration doc from [here](https://stash.run/docs/latest/guides/backends/overview/).
We are going to store our backed up data into a S3 bucket. At first, we need to create a secret with S3 credentials then we need to create a `BackupStorage` crd. If you want to use a different backend, please read the respective backend configuration doc from [here](https://kubestash.com/docs/latest/guides/backends/overview/).

**Create Storage Secret:**

Expand Down Expand Up @@ -196,7 +196,7 @@ spec:
bucket: kubestash-testing
region: us-east-1
prefix: demo
secret: s3-secret
secretName: s3-secret
usagePolicy:
allowedNamespaces:
from: All
Expand Down Expand Up @@ -277,18 +277,20 @@ spec:
name: s3-storage
retentionPolicy:
name: backup-rp
namespace: demo
namespace: demo
sessions:
- name: frequent
scheduler:
jobTemplate:
backoffLimit: 1
schedule: "*/3 * * * *"
repositories:
- name: s3-repo
backend: s3-backend
directory: /mongodb
encryptionSecret:
name: encry-secret
namespace: demo
name: encry-secret
namespace: demo
addon:
name: mongodb-addon
tasks:
Expand Down
Loading
Loading