Files
rancher-docs/assets/js/17ea1ea1.f4829068.js
T

1 line
12 KiB
JavaScript

"use strict";(self.webpackChunkrancher_docs=self.webpackChunkrancher_docs||[]).push([[39728],{3905:(e,r,t)=>{t.d(r,{Zo:()=>p,kt:()=>d});var n=t(67294);function a(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function o(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function s(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?o(Object(t),!0).forEach((function(r){a(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function i(e,r){if(null==e)return{};var t,n,a=function(e,r){if(null==e)return{};var t,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)t=o[n],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)t=o[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var c=n.createContext({}),l=function(e){var r=n.useContext(c),t=r;return e&&(t="function"==typeof e?e(r):s(s({},r),e)),t},p=function(e){var r=l(e.components);return n.createElement(c.Provider,{value:r},e.children)},u={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},h=n.forwardRef((function(e,r){var t=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),h=l(t),d=a,m=h["".concat(c,".").concat(d)]||h[d]||u[d]||o;return t?n.createElement(m,s(s({ref:r},p),{},{components:t})):n.createElement(m,s({ref:r},p))}));function d(e,r){var t=arguments,a=r&&r.mdxType;if("string"==typeof e||a){var o=t.length,s=new Array(o);s[0]=h;var i={};for(var c in r)hasOwnProperty.call(r,c)&&(i[c]=r[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,s[1]=i;for(var l=2;l<o;l++)s[l]=t[l];return n.createElement.apply(null,s)}return n.createElement.apply(null,t)}h.displayName="MDXCreateElement"},70770:(e,r,t)=>{t.r(r),t.d(r,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>l});var n=t(87462),a=(t(67294),t(3905));const o={title:"Restoring Rancher"},s=void 0,i={unversionedId:"how-to-guides/new-user-guides/backup-restore-and-disaster-recovery/restore-rancher",id:"version-2.6/how-to-guides/new-user-guides/backup-restore-and-disaster-recovery/restore-rancher",title:"Restoring Rancher",description:"This page outlines how to perform a restore with Rancher.",source:"@site/versioned_docs/version-2.6/how-to-guides/new-user-guides/backup-restore-and-disaster-recovery/restore-rancher.md",sourceDirName:"how-to-guides/new-user-guides/backup-restore-and-disaster-recovery",slug:"/how-to-guides/new-user-guides/backup-restore-and-disaster-recovery/restore-rancher",permalink:"/v2.6/how-to-guides/new-user-guides/backup-restore-and-disaster-recovery/restore-rancher",draft:!1,editUrl:"https://github.com/rancher/rancher-docs/edit/main/versioned_docs/version-2.6/how-to-guides/new-user-guides/backup-restore-and-disaster-recovery/restore-rancher.md",tags:[],version:"2.6",lastUpdatedAt:1668452187,formattedLastUpdatedAt:"Nov 14, 2022",frontMatter:{title:"Restoring Rancher"},sidebar:"tutorialSidebar",previous:{title:"Backing up Rancher",permalink:"/v2.6/how-to-guides/new-user-guides/backup-restore-and-disaster-recovery/back-up-rancher"},next:{title:"Migrating Rancher to a New Cluster",permalink:"/v2.6/how-to-guides/new-user-guides/backup-restore-and-disaster-recovery/migrate-rancher-to-new-cluster"}},c={},l=[{value:"Additional Steps for Rollbacks with Rancher v2.6.4+",id:"additional-steps-for-rollbacks-with-rancher-v264",level:3},{value:"Create the Restore Custom Resource",id:"create-the-restore-custom-resource",level:3},{value:"Logs",id:"logs",level:3},{value:"Cleanup",id:"cleanup",level:3},{value:"Known Issues",id:"known-issues",level:3}],p={toc:l};function u(e){let{components:r,...t}=e;return(0,a.kt)("wrapper",(0,n.Z)({},p,t,{components:r,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"This page outlines how to perform a restore with Rancher."),(0,a.kt)("admonition",{title:"Important:",type:"note"},(0,a.kt)("ul",{parentName:"admonition"},(0,a.kt)("li",{parentName:"ul"},"Follow the instructions from this page for restoring rancher on the same cluster where it was backed up from. In order to migrate rancher to a new cluster, follow the steps to ",(0,a.kt)("a",{parentName:"li",href:"/v2.6/how-to-guides/new-user-guides/backup-restore-and-disaster-recovery/migrate-rancher-to-new-cluster"},"migrate rancher.")),(0,a.kt)("li",{parentName:"ul"},"While restoring rancher on the same setup, the operator will scale down the rancher deployment when restore starts, and it will scale back up the deployment once restore completes. So Rancher will be unavailable during the restore."),(0,a.kt)("li",{parentName:"ul"},"If you need to restore Rancher to a previous version after an upgrade, see the ",(0,a.kt)("a",{parentName:"li",href:"/v2.6/getting-started/installation-and-upgrade/install-upgrade-on-a-kubernetes-cluster/rollbacks"},"rollback documentation.")))),(0,a.kt)("h3",{id:"additional-steps-for-rollbacks-with-rancher-v264"},"Additional Steps for Rollbacks with Rancher v2.6.4+"),(0,a.kt)("p",null,"In Rancher v2.6.4, the cluster-api module has been upgraded from v0.4.4 to v1.0.2 in which the apiVersion of CAPI CRDs are upgraded from ",(0,a.kt)("inlineCode",{parentName:"p"},"cluster.x-k8s.io/v1alpha4")," to ",(0,a.kt)("inlineCode",{parentName:"p"},"cluster.x-k8s.io/v1beta1"),". This has the effect of causing rollbacks from Rancher v2.6.4 to any previous version of Rancher v2.6.x to fail because the previous version the CRDs needed to roll back are no longer available in v1beta1."),(0,a.kt)("p",null,"To avoid this, the Rancher resource cleanup scripts should be run ",(0,a.kt)("strong",{parentName:"p"},"before")," the restore or rollback is attempted. Specifically, two scripts have been created to assist you: one to clean up the cluster (",(0,a.kt)("inlineCode",{parentName:"p"},"cleanup.sh"),"), and one to check for any Rancher-related resources in the cluster (",(0,a.kt)("inlineCode",{parentName:"p"},"verify.sh"),"). Details on the cleanup script can be found in the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/rancher/rancher-cleanup"},"rancher/rancher-cleanup repo"),"."),(0,a.kt)("admonition",{type:"caution"},(0,a.kt)("p",{parentName:"admonition"},"Rancher will be down as the ",(0,a.kt)("inlineCode",{parentName:"p"},"cleanup")," script runs as it deletes the resources created by rancher.")),(0,a.kt)("p",null,"The additional preparations:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"Follow these ",(0,a.kt)("a",{parentName:"li",href:"https://github.com/rancher/rancher-cleanup/blob/main/README.md"},"instructions")," to run the scripts."),(0,a.kt)("li",{parentName:"ol"},"Follow these ",(0,a.kt)("a",{parentName:"li",href:"https://rancher.com/docs/rancher/v2.6/en/backups/migrating-rancher/"},"instructions")," to install the rancher-backup Helm chart on the existing cluster and restore the previous state.",(0,a.kt)("ol",{parentName:"li"},(0,a.kt)("li",{parentName:"ol"},"Omit Step 3."),(0,a.kt)("li",{parentName:"ol"},"When Step 4 is reached, install the required Rancher v2.6.x version on the local cluster you intend to roll back to.")))),(0,a.kt)("h3",{id:"create-the-restore-custom-resource"},"Create the Restore Custom Resource"),(0,a.kt)("p",null,"A restore is performed by creating a Restore custom resource."),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("p",{parentName:"li"},"In the upper left corner, click ",(0,a.kt)("strong",{parentName:"p"},"\u2630 > Cluster Management"),".")),(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("p",{parentName:"li"},"On the ",(0,a.kt)("strong",{parentName:"p"},"Clusters")," page, go to the ",(0,a.kt)("inlineCode",{parentName:"p"},"local")," cluster and click ",(0,a.kt)("strong",{parentName:"p"},"Explore"),". The ",(0,a.kt)("inlineCode",{parentName:"p"},"local")," cluster runs the Rancher server.")),(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("p",{parentName:"li"},"In the left navigation bar, click ",(0,a.kt)("strong",{parentName:"p"},"Rancher Backups > Restores"),".")),(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("p",{parentName:"li"},"Click ",(0,a.kt)("strong",{parentName:"p"},"Create"),".")),(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("p",{parentName:"li"},"Create the Restore with the form, or with YAML. For creating the Restore resource using form, refer to the ",(0,a.kt)("a",{parentName:"p",href:"/v2.6/reference-guides/backup-restore-configuration/restore-configuration"},"configuration reference")," and to the ",(0,a.kt)("a",{parentName:"p",href:"/v2.6/reference-guides/backup-restore-configuration/examples"},"examples."))),(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("p",{parentName:"li"},"For using the YAML editor, we can click ",(0,a.kt)("strong",{parentName:"p"},"Create > Create from YAML"),". Enter the Restore YAML."),(0,a.kt)("pre",{parentName:"li"},(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},"apiVersion: resources.cattle.io/v1\nkind: Restore\nmetadata:\n name: restore-migration\nspec:\n backupFilename: backup-b0450532-cee1-4aa1-a881-f5f48a007b1c-2020-09-15T07-27-09Z.tar.gz\n encryptionConfigSecretName: encryptionconfig\n storageLocation:\n s3:\n credentialSecretName: s3-creds\n credentialSecretNamespace: default\n bucketName: rancher-backups\n folder: rancher\n region: us-west-2\n endpoint: s3.us-west-2.amazonaws.com\n")),(0,a.kt)("p",{parentName:"li"}," For help configuring the Restore, refer to the ",(0,a.kt)("a",{parentName:"p",href:"/v2.6/reference-guides/backup-restore-configuration/restore-configuration"},"configuration reference")," and to the ",(0,a.kt)("a",{parentName:"p",href:"/v2.6/reference-guides/backup-restore-configuration/examples"},"examples."))),(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("p",{parentName:"li"},"Click ",(0,a.kt)("strong",{parentName:"p"},"Create"),"."))),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Result:")," The rancher-operator scales down the rancher deployment during restore, and scales it back up once the restore completes. The resources are restored in this order:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"Custom Resource Definitions (CRDs)"),(0,a.kt)("li",{parentName:"ol"},"Cluster-scoped resources"),(0,a.kt)("li",{parentName:"ol"},"Namespaced resources")),(0,a.kt)("h3",{id:"logs"},"Logs"),(0,a.kt)("p",null,"To check how the restore is progressing, you can check the logs of the operator. Run this command to follow the logs:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"kubectl logs -n cattle-resources-system -l app.kubernetes.io/name=rancher-backup -f\n")),(0,a.kt)("h3",{id:"cleanup"},"Cleanup"),(0,a.kt)("p",null,"If you created the restore resource with kubectl, remove the resource to prevent a naming conflict with future restores."),(0,a.kt)("h3",{id:"known-issues"},"Known Issues"),(0,a.kt)("p",null,"In some cases, after restoring the backup, Rancher logs will show errors similar to the following:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"2021/10/05 21:30:45 [ERROR] error syncing 'c-89d82/m-4067aa68dd78': handler rke-worker-upgrader: clusters.management.cattle.io \"c-89d82\" not found, requeuing\n")),(0,a.kt)("p",null,"This happens because one of the resources that was just restored has finalizers, but the related resources have been deleted so the handler cannot find it."),(0,a.kt)("p",null,"To eliminate the errors, we need to find and delete the resource that causes the error. See more information ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/rancher/rancher/issues/35050#issuecomment-937968556"},"here")))}u.isMDXComponent=!0}}]);