Skip to content

Commit

Permalink
Add Supported Backends Docs
Browse files Browse the repository at this point in the history
Signed-off-by: Anisur Rahman <[email protected]>
  • Loading branch information
anisurrahman75 committed Jan 1, 2024
1 parent b7886d6 commit 539eafc
Show file tree
Hide file tree
Showing 19 changed files with 126 additions and 970 deletions.
21 changes: 14 additions & 7 deletions docs/guides/backends/azure/examples/azure.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
apiVersion: stash.appscode.com/v1alpha1
kind: Repository
apiVersion: storage.kubestash.com/v1alpha1
kind: BackupStorage
metadata:
name: azure-repo
name: azure-storage
namespace: demo
spec:
backend:
storage:
provider: azure
azure:
container: stash-backup
prefix: /demo/deployment/my-deploy
storageSecretName: azure-secret
storageAccount: kubestash
container: kubestash-demo
prefix: /backup/demo/deployment/kubestash-demo
secret: azure-secret
usagePolicy:
allowedNamespaces:
from: All
default: true
deletionPolicy: WipeOut
39 changes: 22 additions & 17 deletions docs/guides/backends/azure/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,13 @@ To configure storage secret for this backend, following secret keys are needed:

| Key | Type | Description |
| -------------------- | ---------- | ---------------------------------------------------------- |
| `AZURE_ACCOUNT_NAME` | `Required` | Azure Storage account name |
| `AZURE_ACCOUNT_KEY` | `Required` | Azure Storage account key |

Create storage secret as below,

```bash
$ echo -n '<your-azure-storage-account-name>' > AZURE_ACCOUNT_NAME
$ echo -n '<your-azure-storage-account-key>' > AZURE_ACCOUNT_KEY
$ kubectl create secret generic -n demo azure-secret \
--from-file=./AZURE_ACCOUNT_NAME \
--from-file=./AZURE_ACCOUNT_KEY
secret/azure-secret created
```
Expand All @@ -46,38 +43,46 @@ Following parameters are available for `azure` backend.

| Parameter | Type | Description |
|------------------------| ---------- |-----------------------------------------------------------------------------------------------------------------------------------------|
| `azure.storageAccount` | `Required` | Name of the Storage account. |
| `azure.container` | `Required` | Name of Storage container. |
| `azure.secret` | `Required` | Specify the name of the Secret that contains the access credential for this storage. |
| `azure.secret` | `Required` | Specify the name of the Secret that contains the access credential for this storage. | |
| `azure.prefix` | `Optional` | Path prefix inside the container where backed up data will be stored. |
| `azure.maxConnections` | `Optional` | Maximum number of parallel connections to use for uploading backup data. By default, KubeStash will use maximum 5 parallel connections. |

Below, the YAML of a sample `BackupStorage` crd that uses an Azure Blob container as a backend.

```yaml
apiVersion: stash.appscode.com/v1alpha1
kind: Repository
apiVersion: storage.kubestash.com/v1alpha1
kind: BackupStorage
metadata:
name: azure-repo
name: azure-storage
namespace: demo
spec:
backend:
storage:
provider: azure
azure:
container: stash-backup
prefix: /demo/deployment/my-deploy
storageSecretName: azure-secret
storageAccount: kubestash
container: kubestash-demo
prefix: /backup/demo/deployment/kubestash-demo
secret: azure-secret
usagePolicy:
allowedNamespaces:
from: All
default: true
deletionPolicy: WipeOut
```
Create the `Repository` we have shown above using the following command,
Create the `BackupStorage` we have shown above using the following command,

```bash
$ kubectl apply -f https://github.com/kubestash/docs/raw/{{< param "info.version" >}}/docs/guides/backends/azure/examples/azure.yaml
repository/azure-repo created
backupstorage.storage.kubestash.com/azure-storaqge created
```

Now, we are ready to use this backend to backup our desired data using Stash.
Now, we are ready to use this backend to backup our desired data using KubeStash.

## Next Steps

- Learn how to use Stash to backup workloads data from [here](/docs/guides/workloads/overview/index.md).
- Learn how to use Stash to backup databases from [here](/docs/guides/addons/overview/index.md).
- Learn how to use Stash to backup stand-alone PVC from [here](/docs/guides/volumes/overview/index.md).
- Learn how to use KubeStash to backup workloads data from [here](/docs/guides/workloads/overview/index.md).
- Learn how to use KubeStash to backup databases from [here](/docs/guides/addons/overview/index.md).
- Learn how to use KubeStash to backup stand-alone PVC from [here](/docs/guides/volumes/overview/index.md).
11 changes: 0 additions & 11 deletions docs/guides/backends/b2/examples/b2.yaml

This file was deleted.

87 changes: 0 additions & 87 deletions docs/guides/backends/b2/index.md

This file was deleted.

24 changes: 16 additions & 8 deletions docs/guides/backends/gcs/examples/gcs.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
apiVersion: stash.appscode.com/v1alpha1
kind: Repository
apiVersion: storage.kubestash.com/v1alpha1
kind: BackupStorage
metadata:
name: gcs-repo
name: s3-storage
namespace: demo
spec:
backend:
gcs:
bucket: stash-backup
prefix: /demo/deployment/my-deploy
storageSecretName: gcs-secret
storage:
provider: s3
s3:
endpoint: s3.amazonaws.com # use server URL for s3 compatible other storage service
bucket: kubestash-demo
region: us-west-1
prefix: /backup/demo/deployment/kubestash-demo
secret: s3-secret
usagePolicy:
allowedNamespaces:
from: All
default: true
deletionPolicy: WipeOut
62 changes: 33 additions & 29 deletions docs/guides/backends/gcs/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: GCS Backend | Stash
description: Configure Stash to use Google Cloud Storage (GCS) as Backend.
title: GCS Backend | KubeStash
description: Configure KubeStash to use Google Cloud Storage (GCS) as Backend.
menu:
docs_{{ .version }}:
identifier: backend-gcs
Expand All @@ -14,74 +14,78 @@ section_menu_id: guides

# Google Cloud Storage (GCS)

Stash supports [Google Cloud Storage(GCS)](https://cloud.google.com/storage/) as a backend. This tutorial will show you how to use this backend.
KubeStash supports [Google Cloud Storage(GCS)](https://cloud.google.com/storage/) as a backend. This tutorial will show you how to use this backend.

In order to use Google Cloud Storage as backend, you have to create a `Secret` and a `Repository` object pointing to the desired GCS bucket.
In order to use Google Cloud Storage as backend, you have to create a `Secret` and a `BackupStorage` object pointing to the desired GCS bucket.

> If the bucket already exists, the Google Cloud service account you provide to Stash only needs `Storage Object Creator` role permission. However, if the bucket does not exist, Stash will create the bucket during the first backup. In this case, the Google Cloud service account key used for Stash must have `Storage Object Admin` role permission. To avoid giving this elevated level of permission to Stash, create the bucket manually (either from GCP console or gcloud cli) ahead of time.
> If the bucket already exists, the Google Cloud service account you provide to KubeStash only needs `Storage Object Creator` role permission. However, if the bucket does not exist, KubeStash will create the bucket during the first backup. In this case, the Google Cloud service account key used for KubeStash must have `Storage Object Admin` role permission. To avoid giving this elevated level of permission to KubeStash, create the bucket manually (either from GCP console or gcloud cli) ahead of time.
#### Create Storage Secret

To configure storage secret for this backend, following secret keys are needed:

| Key | Type | Description |
| --------------------------------- | ---------- | ----------------------------------------------------------- |
| `RESTIC_PASSWORD` | `Required` | Password that will be used to encrypt the backup snapshots. |
| `GOOGLE_PROJECT_ID` | `Required` | Google Cloud project ID. |
| `GOOGLE_SERVICE_ACCOUNT_JSON_KEY` | `Required` | Google Cloud service account json key. |

Create storage secret as below,

```bash
$ echo -n 'changeit' > RESTIC_PASSWORD
$ echo -n '<your-project-id>' > GOOGLE_PROJECT_ID
$ mv downloaded-sa-json.key GOOGLE_SERVICE_ACCOUNT_JSON_KEY
$ kubectl create secret generic -n demo gcs-secret \
--from-file=./RESTIC_PASSWORD \
--from-file=./GOOGLE_PROJECT_ID \
--from-file=./GOOGLE_SERVICE_ACCOUNT_JSON_KEY
secret/gcs-secret created
```

### Create Repository
### Create BackupStorage

Now, you have to create a `Repository` crd. You have to provide the storage secret that we have created earlier in `spec.backend.storageSecretName` field.
Now, you have to create a `BackupStorage` crd. You have to provide the storage secret that we have created earlier in `spec.backend.storageSecretName` field.

Following parameters are available for `gcs` backend.

| Parameter | Type | Description |
| -------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `gcs.bucket` | `Required` | Name of Bucket. If the bucket does not exist yet, it will be created in the default location (US). It is not possible at the moment for Stash to create a new bucket in a different location, so you need to create it using Google cloud console. |
| `gcs.prefix` | `Optional` | Path prefix inside the bucket where backed up data will be stored. |
| `gcs.maxConnections` | `Optional` | Maximum number of parallel connections to use for uploading backup data. By default, Stash will use maximum 5 parallel connections. |
| Parameter | Type | Description |
| -------------------- | ---------- |--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `gcs.bucket` | `Required` | Name of Bucket. If the bucket does not exist yet, it will be created in the default location (US). It is not possible at the moment for KubeStash to create a new bucket in a different location, so you need to create it using Google cloud console. |
| `gcs.prefix` | `Optional` | Path prefix inside the bucket where backed up data will be stored. |
| `gcs.maxConnections` | `Optional` | Maximum number of parallel connections to use for uploading backup data. By default, KubeStash will use maximum 5 parallel connections. |

Below, the YAML of a sample `Repository` crd that uses a GCS bucket as a backend.
Below, the YAML of a sample `BackupStorage` crd that uses a GCS bucket as a backend.

```yaml
apiVersion: stash.appscode.com/v1alpha1
kind: Repository
apiVersion: storage.kubestash.com/v1alpha1
kind: BackupStorage
metadata:
name: gcs-repo
name: gcs-storage
namespace: demo
spec:
backend:
storage:
provider: gcs
gcs:
bucket: stash-backup
prefix: /demo/deployment/my-deploy
storageSecretName: gcs-secret
bucket: kubestash-demo
prefix: demo
secret: gcs-secret
usagePolicy:
allowedNamespaces:
from: All
default: true # Use this BackupStorage as the default
deletionPolicy: WipeOut # One of: WipeOut, Delete
```
Create the `Repository` we have shown above using the following command,
Create the `BackupStorage` we have shown above using the following command,

```bash
$ kubectl apply -f https://github.com/kubestash/docs/raw/{{< param "info.version" >}}/docs/guides/backends/gcs/examples/gcs.yaml
repository/gcs-repo created
backupstorage.storage.kubestash.com/gcs-storaqge created
```

Now, we are ready to use this backend to backup our desired data using Stash.
Now, we are ready to use this backend to backup our desired data using KubeStash.

## Next Steps

- Learn how to use Stash to backup workloads data from [here](/docs/guides/workloads/overview/index.md).
- Learn how to use Stash to backup databases from [here](/docs/guides/addons/overview/index.md).
- Learn how to use Stash to backup stand-alone PVC from [here](/docs/guides/volumes/overview/index.md).
- Learn how to use KubeStash to backup workloads data from [here](/docs/guides/workloads/overview/index.md).
- Learn how to use KubeStash to backup databases from [here](/docs/guides/addons/overview/index.md).
- Learn how to use KubeStash to backup stand-alone PVC from [here](/docs/guides/volumes/overview/index.md).
6 changes: 3 additions & 3 deletions docs/guides/backends/local/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ that you must give file system group permission, achieved by specifying `spec.se

Here, we are going to show some sample `BackupStorage` objects that uses different Kubernetes volume as a backend.

##### HostPath volume as Backend
### HostPath volume as Backend

Below, the YAML of a sample `BackupStorage` object that uses a `hostPath` volume as a backend.

Expand Down Expand Up @@ -75,7 +75,7 @@ backupstorage.storage.kubestash.com/local-storage-with-hostpath created
So, in order to use `hostPath` volume as a backend, you must either run initializer job as the `root` user, achieved by specifying
`spec.securityContext.pod.runAsUser` in the BackupStorage configuration, or adjust the permissions of the `hostPath` to allow write access for `non-root` users.

##### PersistentVolumeClaim as Backend
### PersistentVolumeClaim as Backend

Below, the YAML of a sample `BackupStorage` crd that uses a `PersistentVolumeClaim` as a backend.

Expand Down Expand Up @@ -110,7 +110,7 @@ $ kubectl apply -f https://github.com/kubestash/docs/raw/{{< param "info.version
backupstorage.storage.kubestash.com/local-storage-with-pvc created
```

##### NFS volume as Backend
### NFS volume as Backend

Below, the YAML of a sample `BackupStorage` crd that uses an `NFS` volume as a backend.

Expand Down
Loading

0 comments on commit 539eafc

Please sign in to comment.