mirror of
https://github.com/imjasonh/gcloud-help
synced 2026-07-14 08:55:34 +00:00
302 lines
14 KiB
Text
302 lines
14 KiB
Text
NAME
|
|
gcloud beta container backup-restore restore-plans create - create a
|
|
restore plan
|
|
|
|
SYNOPSIS
|
|
gcloud beta container backup-restore restore-plans create
|
|
(RESTORE_PLAN : --location=LOCATION) --backup-plan=BACKUP_PLAN
|
|
--cluster=CLUSTER
|
|
(--all-namespaces | --excluded-namespaces=[EXCLUDED_NAMESPACES,...]
|
|
| --no-namespaces | --selected-applications=SELECTED_APPLICATIONS
|
|
| --selected-namespaces=[SELECTED_NAMESPACES,...]) [--async]
|
|
[--cluster-resource-conflict-policy=CLUSTER_RESOURCE_CONFLICT_POLICY]
|
|
[--description=DESCRIPTION] [--labels=[KEY=VALUE,...]]
|
|
[--namespaced-resource-restore-mode=NAMESPACED_RESOURCE_RESTORE_MODE]
|
|
[--restore-order-file=RESTORE_ORDER_FILE]
|
|
[--volume-data-restore-policy=VOLUME_DATA_RESTORE_POLICY;
|
|
default="no-volume-data-restoration"]
|
|
[--volume-data-restore-policy-bindings=[VOLUME_TYPE=POLICY,...]]
|
|
[--cluster-resource-scope-all-group-kinds
|
|
| --cluster-resource-scope-excluded-group-kinds=[CLUSTER_RESOURCE_SCOPE_EXCLUDED_GROUP_KINDS,
|
|
...] | --cluster-resource-scope-no-group-kinds
|
|
| --cluster-resource-scope-selected-group-kinds=[CLUSTER_RESOURCE_SCOPE_SELECTED_GROUP_KINDS,
|
|
...]]
|
|
[--substitution-rules-file=SUBSTITUTION_RULES_FILE
|
|
| --transformation-rules-file=TRANSFORMATION_RULES_FILE]
|
|
[GCLOUD_WIDE_FLAG ...]
|
|
|
|
DESCRIPTION
|
|
(BETA) Create a Backup for GKE restore plan.
|
|
|
|
EXAMPLES
|
|
To create a restore plan my-restore-plan in project my-project in location
|
|
us-central1, run:
|
|
|
|
$ gcloud beta container backup-restore restore-plans create \
|
|
my-restore-plan --project=my-project --location=us-central1 \
|
|
--cluster=projects/my-project/locations/us-central1/clusters/\
|
|
my-cluster \
|
|
--backup-plan=projects/my-project/locations/us-central1/\
|
|
backupPlans/my-backup-plan --all-namespaces \
|
|
--namespaced-resource-restore-mode=merge-skip-on-conflict
|
|
|
|
POSITIONAL ARGUMENTS
|
|
Restore plan resource - Name of the restore plan to create. Once the plan
|
|
is created, this name can't be changed. This must be 63 or fewer
|
|
characters long and must be unique within the project and location. The
|
|
name may be provided either as a relative name, e.g.
|
|
projects/<project>/locations/<location>/restorePlans/<restorePlan> or as a
|
|
single ID name (with the parent resources provided via options or through
|
|
properties), e.g. RESTORE_PLAN --project=<project> --location=<location>.
|
|
The arguments in this group can be used to specify the attributes of this
|
|
resource. (NOTE) Some attributes are not given arguments in this group but
|
|
can be set in other ways.
|
|
|
|
To set the project attribute:
|
|
◆ provide the argument restore_plan on the command line with a fully
|
|
specified name;
|
|
◆ provide the argument --project on the command line;
|
|
◆ set the property core/project.
|
|
|
|
This must be specified.
|
|
|
|
RESTORE_PLAN
|
|
ID of the restore plan or fully qualified identifier for the restore
|
|
plan.
|
|
|
|
To set the restore_plan attribute:
|
|
▸ provide the argument restore_plan on the command line.
|
|
|
|
This positional argument must be specified if any of the other
|
|
arguments in this group are specified.
|
|
|
|
--location=LOCATION
|
|
Google Cloud location.
|
|
|
|
To set the location attribute:
|
|
▸ provide the argument restore_plan on the command line with a
|
|
fully specified name;
|
|
▸ provide the argument --location on the command line;
|
|
▸ set the property gkebackup/location.
|
|
|
|
REQUIRED FLAGS
|
|
--backup-plan=BACKUP_PLAN
|
|
The BackupPlan from which Backups may be used as the source for
|
|
Restores created via this RestorePlan.
|
|
|
|
Value must be entered as a relative name, e.g.
|
|
projects/<project>/locations/<location>/backupPlans/<backupPlans>.
|
|
|
|
--cluster=CLUSTER
|
|
The target cluster into which Restores created via this RestorePlan
|
|
will restore data. NOTE: the cluster's region must be the same as the
|
|
RestorePlan.
|
|
|
|
Value must be entered as a relative name, e.g.:
|
|
projects/<project>/locations/<location>/clusters/<cluster> for a
|
|
regional cluster or projects/<project>/zones/<zone>/clusters/<cluster>
|
|
for a zonal cluster.
|
|
|
|
The scope of namespaced resources to restore.
|
|
|
|
Exactly one of these must be specified:
|
|
|
|
--all-namespaces
|
|
If true, restore all namespaced resources in the backup.
|
|
|
|
--excluded-namespaces=[EXCLUDED_NAMESPACES,...]
|
|
List of selected namespaces to skip. All namespaced resources in all
|
|
namespaces excluding selected namespaces are restored.
|
|
|
|
--no-namespaces
|
|
If true, do not restore any namespaced resources in the backup.
|
|
|
|
--selected-applications=SELECTED_APPLICATIONS
|
|
List of selected applications to restore. Only those namespaced
|
|
resources which belong to one of the selected applications are
|
|
restored.
|
|
|
|
--selected-namespaces=[SELECTED_NAMESPACES,...]
|
|
List of selected namespaces to restore. Only those namespaced
|
|
resources belonging to a selected namespace are restored.
|
|
|
|
OPTIONAL FLAGS
|
|
--async
|
|
Return immediately, without waiting for the operation in progress to
|
|
complete.
|
|
|
|
--cluster-resource-conflict-policy=CLUSTER_RESOURCE_CONFLICT_POLICY
|
|
Define how to handle restore-time conflicts for cluster-scoped
|
|
resources. CLUSTER_RESOURCE_CONFLICT_POLICY must be one of:
|
|
|
|
use-backup-version
|
|
Selecting 'use-existing-version' means deleting the existing
|
|
version of the conflicting resources before re-creating them from
|
|
the Backup.
|
|
|
|
Note that this is a dangerous option which could cause
|
|
unintentional data loss if used inappropriately. For example,
|
|
deleting a CRD will cause Kubernetes to delete all CRs of that
|
|
type.
|
|
|
|
use-existing-version
|
|
Selecting 'use-existing-version' means no conflicting resources
|
|
will be restored.
|
|
|
|
--description=DESCRIPTION
|
|
The description of the restore plan.
|
|
|
|
--labels=[KEY=VALUE,...]
|
|
List of label KEY=VALUE pairs to add.
|
|
|
|
Keys must start with a lowercase character and contain only hyphens
|
|
(-), underscores (_), lowercase characters, and numbers. Values must
|
|
contain only hyphens (-), underscores (_), lowercase characters, and
|
|
numbers.
|
|
|
|
--namespaced-resource-restore-mode=NAMESPACED_RESOURCE_RESTORE_MODE
|
|
Define how to handle restore-time conflicts for namespaced resources.
|
|
NAMESPACED_RESOURCE_RESTORE_MODE must be one of:
|
|
|
|
delete-and-restore
|
|
When conflicting top-level resources (either Namespaces or
|
|
ProtectedApplications, depending upon the scope) are encountered,
|
|
this will first trigger a delete of the conflicting resource AND
|
|
ALL OF ITS REFERENCED RESOURCES (e.g., all resources in the
|
|
Namespace or all resources referenced by the ProtectedApplication)
|
|
before restoring the resources from the Backup. This mode should
|
|
only be used when you are intending to revert some portion of a
|
|
cluster to an earlier state.
|
|
|
|
fail-on-conflict
|
|
If conflicting top-level resources (either Namespaces or
|
|
ProtectedApplications, depending upon the scope) are encountered at
|
|
the beginning of a restore process, the Restore will fail. If a
|
|
conflict occurs during the restore process itself (e.g., because an
|
|
out of band process creates conflicting resources), a conflict will
|
|
be reported.
|
|
|
|
merge-replace-on-conflict
|
|
This mode merges the backup and the target cluster and replaces the
|
|
conflicting resources with the ones in the backup. If a single
|
|
resource to restore exists in the cluster before restoration, the
|
|
resource will be replaced with the one from the backup. To replace
|
|
an existing resource, the first attempt is to update the resource
|
|
to match the one from the backup; if the update fails, the second
|
|
attempt is to delete the resource and restore it from the backup.
|
|
Note that this mode could cause data loss as it replaces the
|
|
existing resources in the target cluster, and the original PV can
|
|
be retained or deleted depending on its reclaim policy.
|
|
|
|
merge-replace-volume-on-conflict
|
|
This mode merges the backup and the target cluster and skips the
|
|
conflicting resources except volume data. If a PVC to restore
|
|
already exists, this mode will restore/reconnect the volume without
|
|
overwriting the PVC. It is similar to MERGE_SKIP_ON_CONFLICT except
|
|
that it will apply the volume data policy for the conflicting PVCs
|
|
"RESTORE_VOLUME_DATA_FROM_BACKUP:" restore data only and respect
|
|
the reclaim policy of the original PV;
|
|
"REUSE_VOLUME_HANDLE_FROM_BACKUP:" reconnect and respect the
|
|
reclaim policy of the original PV; "NO_VOLUME_DATA_RESTORATION:"
|
|
new provision and respect the reclaim policy of the original PV.
|
|
Note that this mode could cause data loss as the original PV can be
|
|
retained or deleted depending on its reclaim policy.
|
|
|
|
merge-skip-on-conflict
|
|
This mode merges the backup and the target cluster and skips the
|
|
conflicting resources. If a single resource to restore exists in
|
|
the cluster before restoration, the resource will be skipped,
|
|
otherwise it will be restored.
|
|
|
|
--restore-order-file=RESTORE_ORDER_FILE
|
|
If provided, defines a custom order that can be used in a restore,
|
|
which includes dependencies between two group kinds that must be
|
|
honored during a restore, a satisfying group kind and a requiring group
|
|
kind. The satisfying group kind must be restored before the requiring
|
|
group kind.
|
|
|
|
--volume-data-restore-policy=VOLUME_DATA_RESTORE_POLICY; default="no-volume-data-restoration"
|
|
Define how data is populated for restored volumes. If this flag is not
|
|
specified, 'no-volume-data-restoration' will be used.
|
|
VOLUME_DATA_RESTORE_POLICY must be one of:
|
|
|
|
no-volume-data-restoration
|
|
Selecting 'no-volume-data-restoration' means PV will not be
|
|
restored. The restoration will ONLY restore selected PVCs and
|
|
expects corresponding Kubernetes controllers to either dynamically
|
|
provision blank PVs or bind them to pre-provisioned PVs created
|
|
out-of-band.
|
|
|
|
restore-volume-data-from-backup
|
|
Selecting 'restore-volume-data-from-backup' means a new PV will be
|
|
restored using the corresponding volume backup data in the Backup.
|
|
|
|
reuse-volume-handle-from-backup
|
|
Selecting 'reuse-volume-handle-from-backup' means a PV will be
|
|
pre-provisioned using the volume handle of the original PV in the
|
|
Backup.
|
|
|
|
--volume-data-restore-policy-bindings=[VOLUME_TYPE=POLICY,...]
|
|
Dict that binds a supported volume type to a volume data restore
|
|
policy. e.g. gce-persistent-disk=restore-volume-data-from-backup for a
|
|
binding that results in Persistent Disk volumes being restored using
|
|
the "restore volume data from backup" policy.
|
|
|
|
The scope of cluster-scoped resources to restore.
|
|
|
|
At most one of these can be specified:
|
|
|
|
--cluster-resource-scope-all-group-kinds
|
|
If true, all valid cluster-scoped resources will be restored.
|
|
|
|
--cluster-resource-scope-excluded-group-kinds=[CLUSTER_RESOURCE_SCOPE_EXCLUDED_GROUP_KINDS,...]
|
|
List of cluster-scoped resource group kinds to NOT restore from the
|
|
backup. If specified, all valid cluster-scoped resources will be
|
|
restored except for those specified in the list. The format of a
|
|
resource is "<group>/<kind>", e.g. storage.k8s.io/StorageClass for
|
|
StorageClass. Use an empty string for core API group.
|
|
|
|
--cluster-resource-scope-no-group-kinds
|
|
If true, no cluster-scoped resources will be restored.
|
|
|
|
--cluster-resource-scope-selected-group-kinds=[CLUSTER_RESOURCE_SCOPE_SELECTED_GROUP_KINDS,...]
|
|
List of cluster-scoped resource group kinds to restore from the
|
|
backup. If specified, only the selected resources will be restored.
|
|
The format of a resource is "<group>/<kind>", e.g.
|
|
storage.k8s.io/StorageClass for StorageClass. Use an empty string for
|
|
core API group.
|
|
|
|
At most one of these can be specified:
|
|
|
|
--substitution-rules-file=SUBSTITUTION_RULES_FILE
|
|
(DEPRECATED) If provided, defines a set of resource transformations
|
|
that will be applied to resources from the source backup before they
|
|
are created in the target cluster.
|
|
|
|
Flag substitution-rules-file is deprecated. Please use
|
|
--transformation-rules-file instead.
|
|
|
|
--transformation-rules-file=TRANSFORMATION_RULES_FILE
|
|
If provided, defines a set of resource transformations that will be
|
|
applied to resources from the source backup before they are created
|
|
in the target cluster.
|
|
|
|
GCLOUD WIDE FLAGS
|
|
These flags are available to all commands: --access-token-file, --account,
|
|
--billing-project, --configuration, --flags-file, --flatten, --format,
|
|
--help, --impersonate-service-account, --log-http, --project, --quiet,
|
|
--trace-token, --user-output-enabled, --verbosity.
|
|
|
|
Run $ gcloud help for details.
|
|
|
|
API REFERENCE
|
|
This command uses the gkebackup/v1 API. The full documentation for this API
|
|
can be found at:
|
|
https://cloud.google.com/kubernetes-engine/docs/add-on/backup-for-gke
|
|
|
|
NOTES
|
|
This command is currently in beta and might change without notice. This
|
|
variant is also available:
|
|
|
|
$ gcloud alpha container backup-restore restore-plans create
|
|
|