gcloud beta container backup-restore backup-plans create

NAME
gcloud beta container backup-restore backup-plans create - create a backup plan
SYNOPSIS
gcloud beta container backup-restore backup-plans create(BACKUP_PLAN :--location=LOCATION)--cluster=CLUSTER(--all-namespaces    |--selected-applications=SELECTED_APPLICATIONS    |--selected-namespace-labels=SELECTED_NAMESPACE_LABELS    |--selected-namespaces=[SELECTED_NAMESPACES,…])[--async][--deactivated][--description=DESCRIPTION][--labels=[KEY=VALUE,…]][--backup-delete-lock-days=BACKUP_DELETE_LOCK_DAYS--backup-retain-days=BACKUP_RETAIN_DAYS--locked][--encryption-key=ENCRYPTION_KEY--include-secrets--include-volume-data--permissive-mode][--paused--cron-schedule=CRON_SCHEDULE [--target-rpo-minutes=TARGET_RPO_MINUTES :--exclusion-windows-file=EXCLUSION_WINDOWS_FILE]][GCLOUD_WIDE_FLAG]
DESCRIPTION
(BETA) Create a Backup for GKE backup plan.
EXAMPLES
To create a backup planmy-backup-plan inprojectmy-project in locationus-central1, run:
gcloudbetacontainerbackup-restorebackup-planscreatemy-backup-plan--project=my-project--location=us-central1--cluster=projects/my-project/locations/us-central1/clusters/my-cluster--all-namespaces
POSITIONAL ARGUMENTS
Backup plan resource - Name of the backup plan to create. Once the plan iscreated, this name can't be changed. This must be 63 or fewer characters longand must be unique within the project and location. The name may be providedeither as a relative name, e.g.projects/<project>/locations/<location>/backupPlans/<backupPlan>or as a single ID name (with the parent resources provided via options orthrough properties), e.g.BACKUP_PLAN --project=<project>--location=<location>. The arguments in this group can be used tospecify the attributes of this resource. (NOTE) Some attributes are not givenarguments in this group but can be set in other ways.

To set theproject attribute:

  • provide the argumentbackup_plan on the command line with a fullyspecified name;
  • provide the argument--project on the command line;
  • set the propertycore/project.

This must be specified.

BACKUP_PLAN
ID of the backup plan or fully qualified identifier for the backup plan.

To set thebackup_plan attribute:

  • provide the argumentbackup_plan on the command line.

This positional argument must be specified if any of the other arguments in thisgroup are specified.

--location=LOCATION
Google Cloud location.

To set thelocation attribute:

  • provide the argumentbackup_plan on the command line with a fullyspecified name;
  • provide the argument--location on the command line;
  • set the propertygkebackup/location.
REQUIRED FLAGS
--cluster=CLUSTER
Name of the cluster from which backups will be produced. Value must be enteredas a relative name, e.g.:

projects/<project>/locations/<location>/clusters/<cluster>for a regional cluster orprojects/<project>/zones/<zone>/clusters/<cluster>for a zonal cluster.

Exactly one of these must be specified:
--all-namespaces
Scope of the backup includes resources from all namespaces. Mutually exclusivewith --selected-namespaces, --selected-applications and--selected-namespace-labels.
--selected-applications=SELECTED_APPLICATIONS
List of ProtectedApplication instances whose resources are included in thebackup. Mutually exclusive with --all-namespaces, --selected-namespaces and--selected-namespace-labels. e.g:--selected-applications=namespace1/foo,namespace2/bar
--selected-namespace-labels=SELECTED_NAMESPACE_LABELS
List of Namespace labels whose resources are included in the backup. Mutuallyexclusive with --all-namespaces, --selected-namespaces and--selected-applications. e.g:--selected-namespace-labels=namespacelabel1=value1,namespacelabel2=value2
--selected-namespaces=[SELECTED_NAMESPACES,…]
List of namespaces whose resources are included in the backup. Mutuallyexclusive with --all-namespaces, --selected-applications and--selected-namespace-labels. e.g: --selected-namespaces=foo,bar
OPTIONAL FLAGS
--async
Return immediately, without waiting for the operation in progress to complete.
--deactivated
If set, no further changes may be made to this backup plan and no furtherbackups may be created for this plan. Backup deletion is still allowed.
--description=DESCRIPTION
Optional text description for the backup 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, andnumbers. Values must contain only hyphens (-), underscores(_), lowercase characters, and numbers.

--backup-delete-lock-days=BACKUP_DELETE_LOCK_DAYS
Number of days a backup produced via this plan cannot be deleted.

Must be less than or equal to 90 days. If 0, delete operations are allowed.Updating this field does not affect existing backups. Backups created after asuccessful update will inherit this new value.

--backup-retain-days=BACKUP_RETAIN_DAYS
Number of days after which a backup produced via this plan is automaticallydeleted.

Must be less than or equal to 365 days. If not set (value is 0), backups are notautomatically deleted. If set, must be greater than the value forbackup_delete_lock_days. Updating this field does not affect existing backups.Backups created after a successful update will inherit this new value.

--locked
If set, subsequent updates are not allowed to the backup plan's retention policyand this value cannot be changed.
--encryption-key=ENCRYPTION_KEY
Encryption key used for encrypting the backup.

At this time, only the Cloud Key Management Service (Cloud KMS) is supported.Value must be entered as a relative name, e.g.:projects/<project>/locations/<location>/keyRings/<key-ring>/cryptoKeys/<key>.

--include-secrets
If true, secret resources are included in the backup if they fall within thescope. If unset, the default is false.
--include-volume-data
If true, snapshots are created for PD volumes corresponding toPersistentVolumeClaims that fall within the scope. If unset, the default isfalse.
--permissive-mode
If true, backups won't fail when Backup for GKE detects Kubernetes configurationthat is known to cause restore failures.
--paused
If set, automatic backup creation is suppressed. When unset, automatic backupcreation resumes with the next scheduled create event.
--cron-schedule=CRON_SCHEDULE
Schedule on which backups will be automatically created.

Use standardcronsyntax. For example,10 3 * * * will automatically create a backupat 0310 every day. All times are interpreted as UTC. The minimum intervalbetween scheduled backups is 10 minutes.

--target-rpo-minutes=TARGET_RPO_MINUTES
Schedule backups based on target RPO minutes instead of fixed cron schedules.Cannot be used with --cron-schedule.
--exclusion-windows-file=EXCLUSION_WINDOWS_FILE
If provided, defines an array of exclusion windows for RPO based schedules fromthe given config file in yaml. Only used together with --target-rpo-minutes forcreation and rpo-based plans during update.
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 thegkebackup/v1 API. The full documentation forthis 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 variantis also available:
gcloudalphacontainerbackup-restorebackup-planscreate

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-19 UTC.