Skip to content

Backup and Restore#

Warning

The examples herein are illustrative. Always review and adjust all deployment details to align with your actual MSR instance before you execute any commands.

  1. Set MSR to Repository Read-Only mode.

    Before you initiate the backup, set MSR to Repository Read-Only mode to prevent new data from being written during the process, minimizing inconsistencies.

    1. Log in to MSR as an administrator.
    2. Navigate to Administration > Configuration.
    3. Under System Settings, enable the Repository Read-Only option.
    4. Click Save to apply the changes.
  2. Exclude Redis Persistent Volume Claims (PVCs), Persistent Volumes (PVs), and PODs from the backup:

    kubectl -n <msr4 namespace> label pod <msr4 redis pod> \
      velero.io/exclude-from-backup=true
    kubectl -n <msr4 namespace> label pvc <msr4 redis pvc> \
      velero.io/exclude-from-backup=true
    kubectl label pv/$(kubectl -n <msr4 namespace> get pvc <msr4 redis pvc> \
      --template={{.spec.volumeName}}) velero.io/exclude-from-backup=true
    
  3. Create the MSR backup:

    Note

    If Redis and/or Postgres are in different namespaces than MSR, include all of the namespaces in the backup command:

    velero backup create <backup name> --include-namespaces postgres,msr4 [..]
    
  4. If you use postgres-operator as the database provider for MSR, verify that the target (recovery) Kubernetes cluster includes ClusterRole postgres-pod:

    1. Verify that the ClusterRole exists:

      kubectl get clusterrole postgres-pod
      
    2. If the output of the command above is empty, manually create the role in postgres-pod.yml:

      apiVersion: rbac.authorization.k8s.io/v1
      kind: ClusterRole
      metadata:
        annotations:
          meta.helm.sh/release-name: postgres-operator
          meta.helm.sh/release-namespace: <msr4 namespace>
        labels:
          app.kubernetes.io/instance: postgres-operator
          app.kubernetes.io/managed-by: Helm
          app.kubernetes.io/name: postgres-operator
          helm.sh/chart: postgres-operator-1.14.0
        name: postgres-pod
        resourceVersion: "66364"
      rules:
      - apiGroups:
        - ""
        resources:
        - endpoints
        verbs:
        - create
        - delete
        - deletecollection
        - get
        - list
        - patch
        - update
        - watch
      - apiGroups:
        - ""
        resources:
        - pods
        verbs:
        - get
        - list
        - patch
        - update
        - watch
      - apiGroups:
        - ""
        resources:
        - services
        verbs:
        - create
      
  5. Apply Postgres Pod to the target (recovery) Kubernetes cluster:

    kubectl apply -f postgres-pod.yml
    
  6. Restore MSR on the target (recovery) Kubernetes cluster:

  7. Reconfigure the restored instance of MSR on the target (recovery) Kubernetes cluster:

    1. Locate the Postgres Database service IP:

      kubectl get svc \
        -l application=spilo,cluster-name=msr-postgres,spilo-role=master \
        -o jsonpath={.items..spec.clusterIP} -n <postgres or msr4 namespace>
      
    2. Reconfigure MSR:

      Note

      Do not include the URL port for expose.tls.auto.commonName and expose.ingress.hosts.core if either is configured. Use only IP or DNS.

      helm upgrade <MSR 4 Helm deployment name> \
        oci://registry.mirantis.com/harbor/helm/msr --debug \
        --set externalURL=https://<Restored MSR 4 URL> -n <MSR 4 namespace> \
        --reuse-values \
        --set expose.tls.auto.commonName=<Restored MSR 4 URL> \
        --set expose.ingress.hosts.core=<Restored MSR 4 URL> \
        --set database.external.host=<Postgres Database's service IP>