|
| 1 | +--- |
| 2 | +title: "Backup API Type" |
| 3 | +layout: docs |
| 4 | +--- |
| 5 | + |
| 6 | +## Use |
| 7 | + |
| 8 | +Use the `Backup` API type to request the Velero server to perform a backup. Once created, the |
| 9 | +Velero Server immediately starts the backup process. |
| 10 | + |
| 11 | +## API GroupVersion |
| 12 | + |
| 13 | +Backup belongs to the API group version `velero.io/v1`. |
| 14 | + |
| 15 | +## Definition |
| 16 | + |
| 17 | +Here is a sample `Backup` object with each of the fields documented: |
| 18 | + |
| 19 | +```yaml |
| 20 | +# Standard Kubernetes API Version declaration. Required. |
| 21 | +apiVersion: velero.io/v1 |
| 22 | +# Standard Kubernetes Kind declaration. Required. |
| 23 | +kind: Backup |
| 24 | +# Standard Kubernetes metadata. Required. |
| 25 | +metadata: |
| 26 | + # Backup name. May be any valid Kubernetes object name. Required. |
| 27 | + name: a |
| 28 | + # Backup namespace. Must be the namespace of the Velero server. Required. |
| 29 | + namespace: velero |
| 30 | +# Parameters about the backup. Required. |
| 31 | +spec: |
| 32 | + # CSISnapshotTimeout specifies the time used to wait for |
| 33 | + # CSI VolumeSnapshot status turns to ReadyToUse during creation, before |
| 34 | + # returning error as timeout. The default value is 10 minute. |
| 35 | + csiSnapshotTimeout: 10m |
| 36 | + # ItemOperationTimeout specifies the time used to wait for |
| 37 | + # asynchronous BackupItemAction operations |
| 38 | + # The default value is 4 hour. |
| 39 | + itemOperationTimeout: 4h |
| 40 | + # resourcePolicy specifies the referenced resource policies that backup should follow |
| 41 | + # optional |
| 42 | + resourcePolicy: |
| 43 | + kind: configmap |
| 44 | + name: resource-policy-configmap |
| 45 | + # Array of namespaces to include in the backup. If unspecified, all namespaces are included. |
| 46 | + # Optional. |
| 47 | + includedNamespaces: |
| 48 | + - '*' |
| 49 | + # Array of namespaces to exclude from the backup. Optional. |
| 50 | + excludedNamespaces: |
| 51 | + - some-namespace |
| 52 | + # Array of resources to include in the backup. Resources may be shortcuts (for example 'po' for 'pods') |
| 53 | + # or fully-qualified. If unspecified, all resources are included. Optional. |
| 54 | + includedResources: |
| 55 | + - '*' |
| 56 | + # Array of resources to exclude from the backup. Resources may be shortcuts (for example 'po' for 'pods') |
| 57 | + # or fully-qualified. Optional. |
| 58 | + excludedResources: |
| 59 | + - storageclasses.storage.k8s.io |
| 60 | + # Order of the resources to be collected during the backup process. It's a map with key being the plural resource |
| 61 | + # name, and the value being a list of object names separated by comma. Each resource name has format "namespace/objectname". |
| 62 | + # For cluster resources, simply use "objectname". Optional |
| 63 | + orderedResources: |
| 64 | + pods: mysql/mysql-cluster-replica-0,mysql/mysql-cluster-replica-1,mysql/mysql-cluster-source-0 |
| 65 | + persistentvolumes: pvc-87ae0832-18fd-4f40-a2a4-5ed4242680c4,pvc-63be1bb0-90f5-4629-a7db-b8ce61ee29b3 |
| 66 | + # Whether to include cluster-scoped resources. Valid values are true, false, and |
| 67 | + # null/unset. If true, all cluster-scoped resources are included (subject to included/excluded |
| 68 | + # resources and the label selector). If false, no cluster-scoped resources are included. If unset, |
| 69 | + # all cluster-scoped resources are included if and only if all namespaces are included and there are |
| 70 | + # no excluded namespaces. Otherwise, if there is at least one namespace specified in either |
| 71 | + # includedNamespaces or excludedNamespaces, then the only cluster-scoped resources that are backed |
| 72 | + # up are those associated with namespace-scoped resources included in the backup. For example, if a |
| 73 | + # PersistentVolumeClaim is included in the backup, its associated PersistentVolume (which is |
| 74 | + # cluster-scoped) would also be backed up. |
| 75 | + includeClusterResources: null |
| 76 | + # Array of cluster-scoped resources to exclude from the backup. Resources may be shortcuts |
| 77 | + # (for example 'sc' for 'storageclasses'), or fully-qualified. If unspecified, |
| 78 | + # no additional cluster-scoped resources are excluded. Optional. |
| 79 | + # Cannot work with include-resources, exclude-resources and include-cluster-resources. |
| 80 | + excludedClusterScopedResources: {} |
| 81 | + # Array of cluster-scoped resources to include from the backup. Resources may be shortcuts |
| 82 | + # (for example 'sc' for 'storageclasses'), or fully-qualified. If unspecified, |
| 83 | + # no additional cluster-scoped resources are included. Optional. |
| 84 | + # Cannot work with include-resources, exclude-resources and include-cluster-resources. |
| 85 | + includedClusterScopedResources: {} |
| 86 | + # Array of namespace-scoped resources to exclude from the backup. Resources may be shortcuts |
| 87 | + # (for example 'cm' for 'configmaps'), or fully-qualified. If unspecified, |
| 88 | + # no namespace-scoped resources are excluded. Optional. |
| 89 | + # Cannot work with include-resources, exclude-resources and include-cluster-resources. |
| 90 | + excludedNamespaceScopedResources: {} |
| 91 | + # Array of namespace-scoped resources to include from the backup. Resources may be shortcuts |
| 92 | + # (for example 'cm' for 'configmaps'), or fully-qualified. If unspecified, |
| 93 | + # all namespace-scoped resources are included. Optional. |
| 94 | + # Cannot work with include-resources, exclude-resources and include-cluster-resources. |
| 95 | + includedNamespaceScopedResources: {} |
| 96 | + # Individual objects must match this label selector to be included in the backup. Optional. |
| 97 | + labelSelector: |
| 98 | + matchLabels: |
| 99 | + app: velero |
| 100 | + component: server |
| 101 | + # Individual object when matched with any of the label selector specified in the set are to be included in the backup. Optional. |
| 102 | + # orLabelSelectors as well as labelSelector cannot co-exist, only one of them can be specified in the backup request |
| 103 | + orLabelSelectors: |
| 104 | + - matchLabels: |
| 105 | + app: velero |
| 106 | + - matchLabels: |
| 107 | + app: data-protection |
| 108 | + # Whether or not to snapshot volumes. Valid values are true, false, and null/unset. If unset, Velero performs snapshots as long as |
| 109 | + # a persistent volume provider is configured for Velero. |
| 110 | + snapshotVolumes: null |
| 111 | + # Where to store the tarball and logs. |
| 112 | + storageLocation: aws-primary |
| 113 | + # The list of locations in which to store volume snapshots created for this backup. |
| 114 | + volumeSnapshotLocations: |
| 115 | + - aws-primary |
| 116 | + - gcp-primary |
| 117 | + # The amount of time before this backup is eligible for garbage collection. If not specified, |
| 118 | + # a default value of 30 days will be used. The default can be configured on the velero server |
| 119 | + # by passing the flag --default-backup-ttl. |
| 120 | + ttl: 24h0m0s |
| 121 | + # whether pod volume file system backup should be used for all volumes by default. |
| 122 | + defaultVolumesToFsBackup: true |
| 123 | + # Whether snapshot data should be moved. If set, data movement is launched after the snapshot is created. |
| 124 | + snapshotMoveData: true |
| 125 | + # The data mover to be used by the backup. If the value is "" or "velero", the built-in data mover will be used. |
| 126 | + datamover: velero |
| 127 | + # UploaderConfig specifies the configuration for the uploader |
| 128 | + uploaderConfig: |
| 129 | + # ParallelFilesUpload is the number of files parallel uploads to perform when using the uploader. |
| 130 | + parallelFilesUpload: 10 |
| 131 | + # Actions to perform at different times during a backup. The only hook supported is |
| 132 | + # executing a command in a container in a pod using the pod exec API. Optional. |
| 133 | + hooks: |
| 134 | + # Array of hooks that are applicable to specific resources. Optional. |
| 135 | + resources: |
| 136 | + - |
| 137 | + # Name of the hook. Will be displayed in backup log. |
| 138 | + name: my-hook |
| 139 | + # Array of namespaces to which this hook applies. If unspecified, the hook applies to all |
| 140 | + # namespaces. Optional. |
| 141 | + includedNamespaces: |
| 142 | + - '*' |
| 143 | + # Array of namespaces to which this hook does not apply. Optional. |
| 144 | + excludedNamespaces: |
| 145 | + - some-namespace |
| 146 | + # Array of resources to which this hook applies. The only resource supported at this time is |
| 147 | + # pods. |
| 148 | + includedResources: |
| 149 | + - pods |
| 150 | + # Array of resources to which this hook does not apply. Optional. |
| 151 | + excludedResources: [] |
| 152 | + # This hook only applies to objects matching this label selector. Optional. |
| 153 | + labelSelector: |
| 154 | + matchLabels: |
| 155 | + app: velero |
| 156 | + component: server |
| 157 | + # An array of hooks to run before executing custom actions. Only "exec" hooks are supported. |
| 158 | + pre: |
| 159 | + - |
| 160 | + # The type of hook. This must be "exec". |
| 161 | + exec: |
| 162 | + # The name of the container where the command will be executed. If unspecified, the |
| 163 | + # first container in the pod will be used. Optional. |
| 164 | + container: my-container |
| 165 | + # The command to execute, specified as an array. Required. |
| 166 | + command: |
| 167 | + - /bin/uname |
| 168 | + - -a |
| 169 | + # How to handle an error executing the command. Valid values are Fail and Continue. |
| 170 | + # Defaults to Fail. Optional. |
| 171 | + onError: Fail |
| 172 | + # How long to wait for the command to finish executing. Defaults to 30 seconds. Optional. |
| 173 | + timeout: 10s |
| 174 | + # An array of hooks to run after all custom actions and additional items have been |
| 175 | + # processed. Only "exec" hooks are supported. |
| 176 | + post: |
| 177 | + # Same content as pre above. |
| 178 | +# Status about the Backup. Users should not set any data here. |
| 179 | +status: |
| 180 | + # The version of this Backup. The only version supported is 1. |
| 181 | + version: 1 |
| 182 | + # The date and time when the Backup is eligible for garbage collection. |
| 183 | + expiration: null |
| 184 | + # The current phase. |
| 185 | + # Valid values are New, FailedValidation, InProgress, WaitingForPluginOperations, |
| 186 | + # WaitingForPluginOperationsPartiallyFailed, FinalizingafterPluginOperations, |
| 187 | + # FinalizingPartiallyFailed, Completed, PartiallyFailed, Failed. |
| 188 | + phase: "" |
| 189 | + # An array of any validation errors encountered. |
| 190 | + validationErrors: null |
| 191 | + # Date/time when the backup started being processed. |
| 192 | + startTimestamp: 2019-04-29T15:58:43Z |
| 193 | + # Date/time when the backup finished being processed. |
| 194 | + completionTimestamp: 2019-04-29T15:58:56Z |
| 195 | + # Number of volume snapshots that Velero tried to create for this backup. |
| 196 | + volumeSnapshotsAttempted: 2 |
| 197 | + # Number of volume snapshots that Velero successfully created for this backup. |
| 198 | + volumeSnapshotsCompleted: 1 |
| 199 | + # Number of attempted BackupItemAction operations for this backup. |
| 200 | + backupItemOperationsAttempted: 2 |
| 201 | + # Number of BackupItemAction operations that Velero successfully completed for this backup. |
| 202 | + backupItemOperationsCompleted: 1 |
| 203 | + # Number of BackupItemAction operations that ended in failure for this backup. |
| 204 | + backupItemOperationsFailed: 0 |
| 205 | + # Number of warnings that were logged by the backup. |
| 206 | + warnings: 2 |
| 207 | + # Number of errors that were logged by the backup. |
| 208 | + errors: 0 |
| 209 | + # An error that caused the entire backup to fail. |
| 210 | + failureReason: "" |
| 211 | +``` |
0 commit comments