oadp
backup create
Create a snapshot of the entire IBM Software Hub instance (when installed on Container Storage Interface (CSI) volumes) or create a restic backup of an entire IBM Software Hub instance on an S3-compatible object store.
Syntax
cpd-cli oadp backup create <cpd-snapshot-name> \
[--aux-service-image-prefix=<backup-hook-image-prefix>] \
[--backup-type] \
[--cleanup-completed-resources=true|false] \
[--csi-snapshot-timeout=<h,m,s>] \
[--default-volumes-to-restic] \
[--default-volumes-to-fs-backup] \
[--enforce-check=true|false] \
[--exclude-resources=<resource.group1,resource.group2,...>] \
[--exclude-tenant-operator-namespace] \
[--grant-image-puller-role=true|false] \
[--hook-kind=br|checkpoint] \
[--image-prefix=<image-registry-prefix>] \
[--include-cluster-resources=true|false] \
[--include-namespaces=<project-name1,project-name2,...>] \
[--include-resources=<resource-name1,resource-name2,...>] \
[--labels=<map<label,label,...>>] \
[--log-level=info|debug|warn|error|panic|trace] \
[--posthooks=true|false] \
[--prehooks=true|false] \
[--scale-always] \
[--scale-wait-timeout=<h,m,s>] \
[--selector=<label-selector>] \
[--skip-hooks] \
[--snapshot-volumes=true|false] \
[--storage-location=<backup-location>] \
[--tenant-operator-namespace] \
[--try-skip-volume-selinux-label=true|false] \
[--ttl=<h,m,s>] \
[--use-retain-pv-reclaim-policy] \
[--values=<yaml-file-name1,yaml-file-name2,...>] \
[--vol-mnt-pod-cpu-limit=<cpu-limit-value>] \
[--vol-mnt-pod-cpu-request=<cpu-request-value>] \
[--vol-mnt-pod-mem-limit=<memory-limit-value>] \
[--vol-mnt-pod-mem-request=<memory-request-value>] \
[--vol-mnt-service-account=<service-request-value>] \
[--volume-snapshot-locations=<volume-snapshot-location1,volume-snapshot-location2,...>] \
[--wait-timeout=<h,m,s>] \
[--with-checkpoint] \
# Global options
[--add_dir_header=true|false] \
[--alsologtostderr=true|false] \
[--cpd-namespace=<cpd-namespace>] \
[--kubeconfig=<kubeconfig-paths> \
[--log-level=info|debug|warn|error|panic|trace] \
[--log-backtrace-at traceLocation=<integer>] \
[--log-dir=<log_directory>] \
[--log-file=<log_file_name>] \
[--log_file_max_size=<uint>] \
[--logtostderr=true|false] \
[--namespace=<namespace-name>] \
[--one-output=true|false] \
[--skip-headers=true|false] \
[--skip-log-headers=true|false] \
[--stderrthreshold severity=<integer>] \
[--v=<integer>] \
[--verbose \
[--vmodule moduleSpec=<pattern1, pattern2, and so on>]
Arguments
Table 1: Command arguments
| Argument | Description |
|---|---|
<cpd-snapshot-name> |
The name of the snapshot to create. |
Table 2: Global options arguments
| Argument | Description |
|---|---|
<trace-location> |
The stack trace location |
<severity> |
The log severity level |
Options
Table 1: Command options
| Option | Description |
|---|---|
--aux-service-image-prefix |
Specify the backup hook job image
prefix (if configurable).
|
--backup-type |
The type of object that is being
backed up.
|
--cleanup-completed-resources |
When set to "true", deletes
completed Kubernetes jobs and pods.
|
--csi-snapshot-timeout |
The CSI snapshot creation timeout
duration ('h' for hours, 'm' for minutes, 's' for
seconds).
|
--default-volumes-to-restic |
Back up all pod volumes using
restic without applying annotation on the pod. Note: This option is deprecated in Cloud Pak for Data and
will be removed in a future release. Use
--default-volumes-to-fs-backup instead.
|
--default-volumes-to-fs-backup |
Back up all pod volumes using
restic without applying annotation on the pod.
|
--enforce-check |
Check OADP
DataProtectionApplication (dpa) resources and perform other
validations.
|
--exclude-resources |
Resources to exclude from
the restore, formatted as resource.group (for example,
storageclasses.storage.k8s.io).
|
--exclude-tenant-operator-namespace |
Exclude the tenant operand
namespaces that include tenant specific Cloud Pak Foundation Service Operators and IBM Software Hub
Operators.
|
--grant-image-puller-role |
Grants IBM Software Hub instance
namespaces permission to pull images from the OADP/Velero namespace. This option is used for
air-gapped installations.
|
--help
|
Display command
help.
|
--hook-kind |
The backup hook type. By default,
backup configmap pre-hook and post-hooks are called and are used for offline backups. When the value
is "checkpoint", checkpoint backup pre-hook and post-hooks are called and are used for
non-disruptive backups.
|
--image-prefix |
Specify the image registry
prefix.
|
--include-cluster-resources |
Include the cluster-scoped
resources in the backup.
|
--include-namespaces |
Include the specified
namespaces, including tethered namespaces, in the backup.
|
--include-resources |
Resources to include in the
backup, formatted as resource.group, such as storageclasses.storage.k8s.io (use '\*' for all
resources).
|
--labels |
Labels to apply to the
backup.
|
--posthooks |
Run the default scale-up of K8's
resources and configmap post-restore hooks.
|
--prehooks |
Run default scale down of K8's
resources and configmap pre-backup hooks.
|
--scale-always |
Quiesce via scale
down.
|
--scale-wait-timeout |
The scale wait timeout duration
('h' for hours, 'm' for minutes, 's' for seconds).
|
--selector
|
Only back up resources that
match the label selector.
|
--skip-hooks |
Skip the default scale down of
resources and backup configmap hooks.
|
--snapshot-volumes |
Take snapshots of persistent
volumes as part of the backup. When set to false, the volume is backed-up using restic. When set to
true, a volume snapshot is created.
|
--storage-location |
The backup location to use for the
backup.
|
--tenant-operator-namespace |
Restrict the scope of backup or
restore commands to tenant operand namespaces that include tenant specific Cloud Pak Foundation
Service Operators and IBM Software Hub Operators only.
|
--try-skip-volume-selinux-label |
Add the TrySkipVolumeSELinuxLabel
annotation and selinux runtimeClassName to the
cpdbr-vol-mnt-pod.
|
--ttl |
Specify how long to keep the data
('h' for hours, 'm' for minutes, 's' for seconds).
|
--use-retain-pv-reclaim-policy |
Change persistent volumes to use
the retain reclaim policy for backups.
|
--values |
Specify values in one or more YAML
files.
|
--vol-mnt-pod-cpu-limit |
Set the CPU limit for the
cpdbr-vol-mnt pod.
|
--vol-mnt-pod-cpu-request |
Set the CPU request for the
cpdbr-vol-mnt pod.
|
--vol-mnt-pod-mem-limit |
Set the memory limit for the
cpdbr-vol-mnt pod.
|
--vol-mnt-pod-mem-request |
Set the memory request for the
cpdbr-vol-mnt pod.
|
--vol-mnt-service-account |
The service account for the
cpdbr-vol-mnt pod.
|
--volume-snapshot-locations |
List of locations (at most one per
provider) where volume snapshots are stored.
|
--wait-timeout |
The wait timeout setting ('h' for
hours, 'm' for minutes, 's' for seconds).
|
--with-checkpoint |
Run a checkpoint before
backup.
|
Global options
You can also use the following global options with this command:
Table 2: Command global options
| Option | Description |
|---|---|
--add_dir_header |
Add the file directory to the
header of log messages.
|
--alsologtostderr |
Log to standard error as well as
files.
Note: This option has no effect when
--logtostderr=true. |
--cpd-namespace |
The IBM Software Hub namespace in
which the utility operates.
|
--kubeconfig |
Paths to a kubeconfig. Only
required if out-of-cluster.
|
--log-level |
The command log
level.
|
--log-backtrace-at traceLocation |
When logging hits line file:N,
emit a stack trace.
|
--log-dir |
If non-empty, write log files in
this directory.
|
--log-file |
If non-empty, use this log
file.
|
--log_file_max_size |
The maximum size, in MB, that a
log file can grow to. If you specify 0, the maximum file size is
unlimited.
|
--logtostderr |
Log to standard error instead of
files.
|
--namespace
|
The namespace where OADP is
installed.
|
--one-output |
Specifies whether to only write
logs to their native severity level.
|
--skip-headers |
Specifies whether to avoid header
prefixes in log messages.
|
--skip-log-headers |
Specifies whether to avoid header
prefixes when opening log files.
Note: This option has no effect when
--logtostderr=true. |
--stderrthreshold severity |
Logs at or above the specified
threshold. Go to stderr when writing to files and stderr.
|
--v
|
Number for the log level
verbosity.
|
--verbose |
Logs include more detailed
messages.
|
--vmodule moduleSpec |
Comma-separated list of pattern=N
settings for file-filtered logging.
|
Examples
Note: The following examples use the recommended installation environment variables.
It is strongly recommended that you use a script to create environment variables with the correct values for your environment. For more information, see Setting up installation environment variables.
- Create a snapshot with Restic for the entire IBM Cloud Pak for Data instance
(
<cpd-snapshot-name>) in an air-gapped environment. -
cpd-cli oadp backup create <cpd-snapshot-name> \ --cleanup-completed-resources \ --default-volumes-to-fs-backup] \ --exclude-resources='Event,Event.events.k8s.io'\ --image-prefix=registry.redhat.io/ubi9 \ --include-namespaces=<project-name>\ --log-level=debug \ --snapshot-volumes=false \ --verbose - Create a snapshot for the entire IBM Cloud Pak for Data instance, which includes all Tenant Namespaces (Operator, Control Plane and any Tethered Namespaces).
-
cpd-cli oadp backup create <cpd-snapshot-name> \ --tenant-operator-namespace ${CPD_OPERATOR_NS} \ --exclude-tenant-operator-namespace \ --exclude-resources='event,event.events.k8s.io,imagetags.openshift.io,operatorgroups,roles,rolebindings,serviceaccounts,catalogsources.operators.coreos.com,subscriptions.operators.coreos.com,clusterserviceversions.operators.coreos.com,installplans.operators.coreos.com,operandconfig,operandregistry,operandrequest,clients.oidc.security.ibm.com,authentication.operator.ibm.com,namespacescopes,commonservices,clusters.postgresql.k8s.enterprisedb.io' \ --default-volumes-to-fs-backup] \ --snapshot-volumes=false \ --cleanup-completed-resources \ --log-level=debug \ --verbose