storage config changes

This commit is contained in:
rajashree
2020-10-05 06:01:11 -07:00
committed by Catherine Luse
parent 5e63742480
commit 212f280468
3 changed files with 46 additions and 35 deletions
+11 -6
View File
@@ -3,7 +3,9 @@ title: Backups and Disaster Recovery
weight: 5
---
In this section, you'll learn how to create backups of Rancher, how to restore Rancher from backup, and how to migrate Rancher to a new server.
In this section, you'll learn how to create backups of Rancher, how to restore Rancher from backup, and how to migrate Rancher to a new server.
Rancher version must be v2.5.0 and up to use this approach of backing up and restoring Rancher.
- [Changes in Rancher v2.5](#changes-in-rancher-v2-5)
- [Backup and Restore for Rancher Prior to v2.5](#backup-and-restore-for-rancher-prior-to-v2-5)
@@ -27,13 +29,16 @@ In Rancher v2.4, it was only supported to install Rancher on two types of Kubern
In Rancher v2.5, it is now supported to install Rancher hosted Kubernetes clusters, such as Amazon EKS clusters, which do not expose etcd to a degree that would allow snapshots to be created by an external tool. etcd doesn't need to be exposed for `rancher-backup` to work, because the operator gathers resources by making calls to `kube-apiserver`.
### Backup and Restore for Rancher Prior to v2.5
### Backup and Restore for Rancher v2.5 installed with Docker
For Rancher installed with Docker, refer to the same steps used up till 2.5 for [single node backups]({{<baseurl>}}/rancher/v2.x/en/backups/legacy/backup/single-node-backups/) and [restore]({{<baseurl>}}/rancher/v2.x/en/backups/legacy/restore/single-node-restoration/) documentation.
### Backup and Restore for Rancher installed on Kubernetes cluster Prior to v2.5
For Rancher prior to v2.5, the way that Rancher is backed up and restored differs based on the way that Rancher was installed. Our legacy backup and restore documentation is here:
- For Rancher installed on an RKE Kubernetes cluster, refer to the legacy [backup]({{<baseurl>}}/rancher/v2.x/en/backups/legacy/backup/k8s-backups/ha-backups/) and [restore]({{<baseurl>}}/rancher/v2.x/en/backups/legacy/restore/k8s-restore/rke-restore/) documentation.
- For Rancher installed on a K3s Kubernetes cluster, refer to the legacy [backup]({{<baseurl>}}/rancher/v2.x/en/backups/legacy/backup/k8s-backups/k3s-backups/) and [restore]({{<baseurl>}}/rancher/v2.x/en/backups/legacy/restore/k8s-restore/k3s-restore/) documentation.
- For Rancher installed with Docker, refer to the legacy [backup]({{<baseurl>}}/rancher/v2.x/en/backups/legacy/backup/single-node-backups/) and [restore]({{<baseurl>}}/rancher/v2.x/en/backups/legacy/restore/single-node-restoration/) documentation.
### How Backups and Restores Work
@@ -75,10 +80,10 @@ To configure the backup app in Rancher, click **Cluster Explorer** in the upper
Install the backup app as a Helm chart:
```
helm repo add rancherchart https://charts.rancher.io
helm repo add rancher-charts https://charts.rancher.io
helm repo update
helm install rancher-backup-crd rancherchart/rancher-backup-crd -n cattle-resources-system --create-namespace
helm install rancher-backup rancherchart/rancher-backup -n cattle-resources-system
helm install rancher-backup-crd rancher-charts/rancher-backup-crd -n cattle-resources-system --create-namespace
helm install rancher-backup rancher-charts/rancher-backup -n cattle-resources-system
```
# Backing up Rancher
@@ -6,16 +6,13 @@ weight: 3
Configure a storage location where all backups are saved by default. You will have the option to override this with each backup, but will be limited to using an S3-compatible object store.
The storage location is configured at the operator level. Therefore, it must be configured when the `rancher-backup` operator is installed or upgraded.
Only one storage location can be configured for each backup.
Only one storage location can be configured at the operator level.
- [Storage Location Configuration](#storage-location-configuration)
- [No Default Storage Location](#no-default-storage-location)
- [Use the Default Storage Class (gp2)](#use-the-default-storage-class-gp2)
- [S3-compatible Object Store](#s3-compatible-object-store)
- [Existing StorageClass](#existing-storageclass)
- [Existing PersistentVolume](#existing-persistentvolume)
- [Use an existing StorageClass](#existing-storageclass)
- [Use an existing PersistentVolume](#existing-persistent-volume)
- [Encryption](#encryption)
- [Example values.yaml for the rancher-backup Helm Chart](#example-values-yaml-for-the-rancher-backup-helm-chart)
@@ -23,11 +20,7 @@ Only one storage location can be configured for each backup.
### No Default Storage Location
This option is the default.
### Use the Default Storage Class (gp2)
If this option is selected, the cluster's [default StorageClass](https://kubernetes.io/docs/tasks/administer-cluster/change-default-storage-class/) will be used to store the backups.
You can choose to not have any operator-level storage location configured. If you select this option, you must configure an S3-compatible object store as the storage location for each individual backup.
### S3-compatible Object Store
@@ -42,25 +35,21 @@ If this option is selected, the cluster's [default StorageClass](https://kuberne
### Existing StorageClass
Configure an existing storage class that will be used to store your backups. For information about creating storage classes in refer to [this section.]({{<baseurl>}}/rancher/v2.x/en/cluster-admin/volumes-and-storage/provisioning-new-storage/#1-add-a-storage-class-and-configure-it-to-use-your-storage-provider)
Installing the `rancher-backup` chart by selecting the StorageClass option will create a Persistent Volume Claim (PVC), and Kubernetes will in turn dynamically provision a Persistent Volume (PV) where all the backups will be saved by default.
If a StorageClass is selected, a new PersistentVolumeClaim will be created on the same host on which the `rancher-backup` operator pod is running. This will in turn create a new PersistentVolume due to dynamic provisioning.
For information about creating storage classes refer to [this section.]({{<baseurl>}}/rancher/v2.x/en/cluster-admin/volumes-and-storage/provisioning-new-storage/#1-add-a-storage-class-and-configure-it-to-use-your-storage-provider)
### Existing PersistentVolume
> **Important**
It is highly recommended to use a StorageClass with a reclaim policy of "Retain". Otherwise if the PVC created by the `rancher-backup` chart gets deleted (either during app upgrade, or accidentally), the PV will get deleted too, which means all backups saved in it will get deleted.
If no such StorageClass is available, after the PV is provisioned, make sure to edit its reclaim policy and set it to "Retain" before storing backups in it.
Configure an existing PersistentVolume that will be used to store your backups. For information about creating PersistentVolumes in Rancher, refer to [this section.]({{<baseurl>}}/rancher/v2.x/en/cluster-admin/volumes-and-storage/attaching-existing-storage/#2-add-a-persistent-volume-that-refers-to-the-persistent-storage)
### Existing Persistent Volume
# Encryption
Select an existing Persistent Volume (PV) that will be used to store your backups. For information about creating PersistentVolumes in Rancher, refer to [this section.]({{<baseurl>}}/rancher/v2.x/en/cluster-admin/volumes-and-storage/attaching-existing-storage/#2-add-a-persistent-volume-that-refers-to-the-persistent-storage)
Resources can be encrypted before they are saved in a backup file.
> **Important**
It is highly recommended to use a Persistent Volume with a reclaim policy of "Retain". Otherwise if the PVC created by the `rancher-backup` chart gets deleted (either during app upgrade, or accidentally), the PV will get deleted too, which means all backups saved in it will get deleted.
The `rancher-backup` operator uses the same process to encrypt the backups as is described in the [official Kubernetes documentation](https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/) for encrypting data at rest. Encryption details are provided in an EncryptionConfiguration YAML file.
You can use any EncryptionConfiguration YAML, including one that is already used in your Kubernetes cluster.
In order for `rancher-backup` operator to use the EncryptionConfiguration, the file must be named `encryption-provider-config.yaml`.
> **Important:** The `rancher-backup` operator doesn't save the EncryptionConfiguration file. The contents of the EncryptionConfiguration file must be saved when a backup is created, and the same file must be used when restoring from this backup.
# Example values.yaml for the rancher-backup Helm Chart
@@ -8,7 +8,9 @@ If you are migrating Rancher to a new Kubernetes cluster, you don't need to inst
### Prerequisites
These instructions assume you have [created a backup](../back-up-rancher) and you have already installed a new Kubernetes cluster where Rancher will be deployed.
It is necessary to use the same hostname that was set as the server URL in the first cluster.
It is required to use the same hostname that was set as the server URL in the first cluster.
Rancher version must be v2.5.0 and up
Rancher can be installed on any Kubernetes cluster, including hosted Kubernetes clusters such as Amazon EKS clusters. For help installing Kubernetes, refer to the documentation of the Kubernetes distribution. One of Rancher's Kubernetes distributions may also be used:
@@ -18,14 +20,29 @@ Rancher can be installed on any Kubernetes cluster, including hosted Kubernetes
### 1. Install the rancher-backup Helm chart
```
helm repo add rancherchart https://charts.rancher.io
helm repo add rancher-charts https://charts.rancher.io
helm repo update
helm install rancher-backup-crd rancherchart/rancher-backup-crd -n cattle-resources-system --create-namespace
helm install rancher-backup rancherchart/rancher-backup -n cattle-resources-system
helm install rancher-backup-crd rancher-charts/rancher-backup-crd -n cattle-resources-system --create-namespace
helm install rancher-backup rancher-charts/rancher-backup -n cattle-resources-system
```
### 2. Restore from backup using a Restore custom resource
If you are using an S3 store as the backup source, and need to use your S3 credentials for restore, create a secret in this cluster using your S3 credentials. The Secret data must have two keys, `accessKey` and `secretKey` containing the s3 credentials like this:
```yaml
apiVersion: v1
kind: Secret
metadata:
name: s3-creds
type: Opaque
data:
accessKey: <Enter your access key>
secretKey: <Enter your secret key>
```
This secret can be created in any namespace, with the above example it will get created in the default namespace
In the Restore custom resource, `prune` must be set to false.
Create a Restore custom resource like the example below:
@@ -76,5 +93,5 @@ Use the same version of Helm to install Rancher, that was used on the first clus
```
helm install rancher rancher-latest/rancher \
--namespace cattle-system \
--set hostname=<same hostname as first Rancher server> \
--set hostname=<same hostname as the server URL from the first Rancher server> \
```