1"use strict";(self.webpackChunkpxdocs_docusaurus=self.webpackChunkpxdocs_docusaurus||[]).push([[8616],{3905:(e,t,o)=>{o.d(t,{Zo:()=>u,kt:()=>k});var r=o(67294);function a(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function n(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function s(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?n(Object(o),!0).forEach((function(t){a(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function l(e,t){if(null==e)return{};var o,r,a=function(e,t){if(null==e)return{};var o,r,a={},n=Object.keys(e);for(r=0;r<n.length;r++)o=n[r],t.indexOf(o)>=0||(a[o]=e[o]);return a}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(r=0;r<n.length;r++)o=n[r],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(a[o]=e[o])}return a}var p=r.createContext({}),i=function(e){var t=r.useContext(p),o=t;return e&&(o="function"==typeof e?e(t):s(s({},t),e)),o},u=function(e){var t=i(e.components);return r.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var o=e.components,a=e.mdxType,n=e.originalType,p=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=i(o),k=a,m=d["".concat(p,".").concat(k)]||d[k]||c[k]||n;return o?r.createElement(m,s(s({ref:t},u),{},{components:o})):r.createElement(m,s({ref:t},u))}));function k(e,t){var o=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var n=o.length,s=new Array(n);s[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:a,s[1]=l;for(var i=2;i<n;i++)s[i]=o[i];return r.createElement.apply(null,s)}return r.createElement.apply(null,o)}d.displayName="MDXCreateElement"},13861:(e,t,o)=>{o.r(t),o.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>c,frontMatter:()=>n,metadata:()=>l,toc:()=>i});var r=o(87462),a=(o(67294),o(3905));const n={title:"Using Velero with Portworx",keywords:["velero, disaster recovery, snapshots, persisten volumes, kubernetes, k8s, heptio ark,"],description:"Learn how the Portworx plugin for Velero can help with disaster recovery in your Kubernetes clusters",noicon:!0,series:"k8s-storage",aliases:["/portworx-install-with-kubernetes/operate-and-maintain-on-kubernetes/disaster-recovery","/docs/portworx-enterprise/operations/operate-kubernetes/storage-operations/disaster-recovery/"],sidebar_position:700},s=void 0,l={unversionedId:"operations/operate-kubernetes/storage-operations/velero",id:"operations/operate-kubernetes/storage-operations/velero",title:"Using Velero with Portworx",description:"Learn how the Portworx plugin for Velero can help with disaster recovery in your Kubernetes clusters",source:"@site/docs/portworx-enterprise/operations/operate-kubernetes/storage-operations/velero.md",sourceDirName:"operations/operate-kubernetes/storage-operations",slug:"/operations/operate-kubernetes/storage-operations/velero",permalink:"/portworx-enterprise/operations/operate-kubernetes/storage-operations/velero",draft:!1,tags:[],version:"current",lastUpdatedAt:1690623727,formattedLastUpdatedAt:"Jul 29, 2023",sidebarPosition:700,frontMatter:{title:"Using Velero with Portworx",keywords:["velero, disaster recovery, snapshots, persisten volumes, kubernetes, k8s, heptio ark,"],description:"Learn how the Portworx plugin for Velero can help with disaster recovery in your Kubernetes clusters",noicon:!0,series:"k8s-storage",aliases:["/portworx-install-with-kubernetes/operate-and-maintain-on-kubernetes/disaster-recovery","/docs/portworx-enterprise/operations/operate-kubernetes/storage-operations/disaster-recovery/"],sidebar_position:700},sidebar:"pxEnterpriseSidebar",previous:{title:"Manage your storage pool",permalink:"/portworx-enterprise/operations/operate-kubernetes/storage-operations/manage-storagepool"},next:{title:"Configure IO profiles",permalink:"/portworx-enterprise/operations/operate-kubernetes/storage-operations/io-profile-in-k8s"}},p={},i=[{value:"Install Velero Plugin",id:"install-velero-plugin",level:2},{value:"Configure Velero to use Portworx snapshots",id:"configure-velero-to-use-portworx-snapshots",level:2},{value:"Creating backups",id:"creating-backups",level:2},{value:"Local Backups",id:"local-backups",level:3},{value:"Cloud Backups",id:"cloud-backups",level:3},{value:"Listing backups",id:"listing-backups",level:2},{value:"Restoring from backups",id:"restoring-from-backups",level:2}],u={toc:i};
1function c(e){let{components:t,...o}=e;return(0,a.kt)("wrapper",(0,r.Z)({},u,o,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"Velero is a utility for managing disaster recovery, specifically for your\nKubernetes cluster resources and persistent volumes. To take snapshots of\nPortworx volumes through Velero you need to install and configure the Portworx\nplugin."),(0,a.kt)("admonition",{type:"note"},(0,a.kt)("p",{parentName:"admonition"},"These instructions are for Velero v1.0 and higher. For older versions of Ark (previous name for the Velero project), please ",(0,a.kt)("a",{parentName:"p",href:"/portworx-enterprise/shared/hidden/kubernetes-operations/disaster-recovery/ark-pre-0.10"},"click here.")," ")),(0,a.kt)("h2",{id:"install-velero-plugin"},"Install Velero Plugin"),(0,a.kt)("p",null,"Portworx needs to be added as a plugin to your existing Velero installation.\nRun the following command to install the Portworx plugin:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"velero plugin add portworx/velero-plugin:1.0.3\n")),(0,a.kt)("p",null,"This should add an init container to your Velero deployment to install the plugin."),(0,a.kt)("h2",{id:"configure-velero-to-use-portworx-snapshots"},"Configure Velero to use Portworx snapshots"),(0,a.kt)("p",null,"Once the plugin is installed, you need to create VolumeSnapshotLocation objects for Velero to use when\ntaking volume snapshots. These specify whether you want to take local or cloud snapshots."),(0,a.kt)("p",null,"Run the following command to create a VolumeSnapshotLocation for local snapshots."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"velero snapshot-location create portworx-local --provider portworx.io/portworx --config type=local\n")),(0,a.kt)("p",null,"Run the following command to create a VolumeSnapshotLocation for cloud snapshots."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"velero snapshot-location create portworx-cloud --provider portworx.io/portworx --config type=cloud,credId=<UUID>\n")),(0,a.kt)("p",null,"After applying the above specs you should see them when you list the VolumeSnapshotLocaions"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get volumesnapshotlocation -n velero\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-output"},"NAME AGE\nportworx-cloud 54m\nportworx-local 54m\n")),(0,a.kt)("p",null,"The valid configuration parameters that can be given through the ",(0,a.kt)("inlineCode",{parentName:"p"},"--config")," argument in the above commands are:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"type"),": Defines the type of snapshot. Valid values: ","[cloud | local]"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"credID"),": Defines the credential Portworx should use when triggering a cloud snapshot."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"PX_NAMESPACE"),": Specify the namespace in which Portworx is installed. This parameter is not required if Portworx\nis installed in ",(0,a.kt)("inlineCode",{parentName:"li"},"kube-system")," namespace. This option is similar to what is specified in other Portworx components\nlike Stork."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"portworx.io/cloudsnap-incremental-count"),": Specify the number of incremental cloud snapshots Portworx should take\nbefore triggering a full backup. This option is similar to what is specified in other Portworx components like Stork.")),(0,a.kt)("p",null,"Here is a sample command that uses all the available config parameters:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"velero snapshot-location create portworx-cloud --provider portworx.io/portworx --config type=cloud,credId=<UUID>,PX_NAMESPACE=portworx,portworx.io/cloudsnap-incremental-count=7\n")),(0,a.kt)("h2",{id:"creating-backups"},"Creating backups"),(0,a.kt)("p",null,"Once you have installed and configured the plugin, every time you take backups\nusing Velero and include PVCs, it will also take Portworx snapshots of your volumes."),(0,a.kt)("h3",{id:"local-backups"},"Local Backups"),(0,a.kt)("p",null,"To backup all your apps in the default namespace and also create local snapshots\nof the volumes, you would use ",(0,a.kt)("inlineCode",{parentName:"p"},"portworx-local")," for the snapshot location:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"velero backup create default-ns-local-backup --include-namespaces=default --snapshot-volumes \\\n --volume-snapsh
1ot-locations portworx-local\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-output"},'Backup request "default-ns-local-backup" submitted successfully.\nRun `velero backup describe default-ns-local-backup` for more details.\n')),(0,a.kt)("h3",{id:"cloud-backups"},"Cloud Backups"),(0,a.kt)("p",null,"To backup all your apps in the default namespace and also create cloud backups\nof the volumes, you would use ",(0,a.kt)("inlineCode",{parentName:"p"},"portworx-cloud")," for the snapshot location:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"velero backup create default-ns-cloud-backup --include-namespaces=default --snapshot-volumes \\\n --volume-snapshot-locations portworx-cloud\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-output"},'Backup request "default-ns-cloud-backup" submitted successfully.\nRun `velero backup describe default-ns-cloud-backup` for more details.\n')),(0,a.kt)("h2",{id:"listing-backups"},"Listing backups"),(0,a.kt)("p",null,"Once the specs and volumes have been backed up you should see the backup marked\nas ",(0,a.kt)("inlineCode",{parentName:"p"},"Completed")," in velero."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"velero get backup\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-output"},"NAME STATUS CREATED EXPIRES STORAGE LOCATION SELECTOR\ndefault-ns-local-backup Completed 2018-11-11 20:10:45 +0000 UTC 29d default <none>\ndefault-ns-cloud-backup Completed 2018-11-11 20:15:45 +0000 UTC 29d default <none>\n")),(0,a.kt)("h2",{id:"restoring-from-backups"},"Restoring from backups"),(0,a.kt)("p",null,"When restoring from backups, a clone volume will be created from the snapshot and\nbound to the restored PVC. To restore from the backup created above you can run\nthe following command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"velero restore create --from-backup default-ns-local-backup\n")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-output"},'Restore request "default-ns-local-backup-20181111201245" submitted successfully.\nRun `velero restore describe default-ns-local-backup-20181111201245` for more details.\n')))}c.isMDXComponent=!0}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.