GKE Backup & Disaster Recovery
Protects stateful GKE workloads using Backup for GKE. Backup for GKE can capture
both Kubernetes resource metadata (manifests, configurations, and secrets) and
the underlying persistent volume (PV) data — but volume data and secrets are
only captured when the backup plan explicitly enables them (see the flags
below).
Attribution
MUST READ: Before executing any gcloud, REST API, or MCP command, you
MUST read Usage Attribution. For commands executed
directly in the terminal (never in generated scripts, Terraform, or user code),
prefix gcloud with
CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:gke-backup-dr)"
and append agent-skills/1.0 (skill:gke-backup-dr) to User-Agent headers.
CLI Reference
# Enable the BackupRestore addon (Slow cluster-level update)
gcloud container clusters update {cluster_name} \
--update-addons=BackupRestore=ENABLED --location={location} --quiet
# Create Backup Plan
gcloud beta container backup-restore backup-plans create {plan_name} \
--project={project_id} --location={location} \
--cluster=projects/{project_id}/locations/{location}/clusters/{cluster_name} \
--all-namespaces \
--include-volume-data --include-secrets \
--backup-retain-days={days} --cron-schedule="{cron}" --quiet
# Trigger Manual Backup
gcloud beta container backup-restore backups create {backup_name} \
--backup-plan={plan_name} --location={location} --quiet
# Create Restore Plan
gcloud beta container backup-restore restore-plans create {restore_plan_name} \
--location={location} \
--cluster=projects/{project_id}/locations/{location}/clusters/{target_cluster_name} \
--backup-plan=projects/{project_id}/locations/{location}/backupPlans/{source_backup_plan_name} \
--all-namespaces \
--cluster-resource-conflict-policy=use-existing-version \
--namespaced-resource-restore-mode=fail-on-conflict --quiet
# Execute Restore
gcloud beta container backup-restore restores create {restore_name} \
--restore-plan={restore_plan_name} --location={location} \
--backup=projects/{project_id}/locations/{location}/backupPlans/{source_backup_plan_name}/backups/{backup_name} \
--quiet
# Verify Restore Status
gcloud beta container backup-restore restores describe {restore_name} \
--restore-plan={restore_plan_name} --location={location}
[!WARNING] --include-volume-data and --include-secrets BOTH DEFAULT TO
FALSE. If you omit them, the backup plan silently produces config-only
backups with no persistent volume snapshots and no Secrets. Always pass both
flags explicitly when the goal is full workload protection.
Notes:
- The
backup-restore command group requires the gcloud beta component
(gcloud components install beta).
--cluster requires the full resource path
projects/{project_id}/locations/{location}/clusters/{cluster_name} (or
projects/{project_id}/zones/{zone}/clusters/{cluster_name} for zonal
clusters), not a bare cluster name.
- Restore plans require exactly one namespaced-resource scope flag:
--all-namespaces, --selected-namespaces={ns1},{ns2},
--excluded-namespaces=..., --selected-applications=..., or
--no-namespaces.
Restore Safety (CRITICAL)
A restore writes into a live cluster and, depending on the conflict policy,
can overwrite or delete existing resources:
--cluster-resource-conflict-policy=use-existing-version keeps existing
cluster-scoped resources (safe default); use-backup-version deletes
the existing version first — deleting a CRD deletes all of its CRs.
--namespaced-resource-restore-mode=fail-on-conflict aborts on any conflict
(safe default); merge-skip-on-conflict skips conflicting resources;
merge-replace-on-conflict and merge-replace-volume-on-conflict
overwrite existing resources or volumes; delete-and-restore deletes
entire conflicting namespaces (and all resources in them) before
restoring.
Rules:
- Validate the restore in a non-production target cluster first.
- Prefer the safe defaults (
use-existing-version + fail-on-conflict)
unless the user explicitly needs to revert live resources.
- Always obtain explicit user confirmation before executing a restore into a
production cluster, and state which conflict policy is in effect and what
it may overwrite or delete.
Best Practices
- CMEK Encryption: Encrypt backup plans using Customer-Managed Encryption
Keys:
--encryption-key=projects/{project_id}/locations/{location}/keyRings/{ring}/cryptoKeys/{key}.
- Scope: Prefer backing up specific namespaces rather than the entire
cluster:
--selected-namespaces={ns1},{ns2} (instead of
--all-namespaces).
- Application Consistency: Recommend quiescing the database or pausing
application writes (e.g. using pre-backup hooks or database-specific tools)
prior to backups to ensure data integrity.
- CSI Volume Snapshots: Ensure that stateful backups utilize GKE's CSI
(Container Storage Interface) driver for volume snapshots to capture
persistent volume data.
- Service Terminology: Always explicitly refer to the service as Backup
for GKE in your response. This distinguishes it from the broader (but
complementary) Google Cloud Backup and Disaster Recovery (DR)
Service, ## Golden Path Backup Defaults
The recommended production golden path configuration for Backup for GKE:
- Addon: BackupRestore addon enabled
(
--update-addons=BackupRestore=ENABLED).
- Volume Inclusion:
--include-volume-data explicitly passed (enabled,
since the service default is false).
- Secret Inclusion:
--include-secrets explicitly passed (enabled, since
the service default is false).
- Retention: Defined retention period (e.g. 30 days via
--backup-retain-days=30).
- Encryption: CMEK enabled (
--encryption-key=...).
Recent Changes
- Cross-project backup and restore (GA): Backup plans can store backups in
a different project than the source cluster, and restore plans can target
clusters in a third project. Enables centralized backup projects (with
immutability/retention managed by a platform team) and cross-project
environment seeding without granting access to the source project.
- Pricing change (effective 2026-03-02): The backup management fee moved
from pod-based to NAMESPACE-based pricing — charged per non-system
namespace in the most recent successful backup of each plan (system
namespaces like
kube-system are excluded). Existing committed use discount
(CUD) holders keep pod-based management pricing until their commitment ends;
everyone else moves to the new model. See
https://cloud.google.com/products/backup-for-gke/pricing-changes.
- Smart Scheduling: RPO-driven backup scheduling as an alternative to
fixed cron schedules — pass
--target-rpo-minutes={minutes} instead of
--cron-schedule when creating the backup plan (optionally with RPO
exclusion windows via --exclusion-windows-file).
- Hyperdisk support: Backup and restore of Hyperdisk ML and
Hyperdisk Balanced High Availability volumes is supported on GKE
clusters running 1.33.1-gke.1959000 and later (Hyperdisk throughput,
extreme, and balanced types are also supported).
Troubleshooting & Common Pitfalls (CRITICAL)
[!IMPORTANT] Slow Operations: Enabling the BackupRestore addon
(--update-addons=BackupRestore=ENABLED) triggers a slow Google Cloud control
plane cluster update that takes several minutes. * Rule: Do not run a
terminal loop waiting for the GKE Backup addon to become active. *
Action: Provide the command to enable the addon, explain that the
operation will proceed in the background, and immediately proceed to write the
backup plan configs. Do not block.
1---2name: gke-backup-dr-23description: >-4 Configures Backup for GKE: the BackupRestore cluster addon, BackupPlan and5 RestorePlan resources, restore workflows, and CMEK-encrypted backups. Use6 for backup policies, disaster recovery, or GKE cluster restores. Don't use7 for database backups.8metadata:9 source: https://skillmd.com/skills/google/gke-backup-dr-210 version: "1.0.1"11 category: Storage12---1314# GKE Backup & Disaster Recovery1516Protects stateful GKE workloads using Backup for GKE. Backup for GKE can capture17both Kubernetes resource metadata (manifests, configurations, and secrets) and18the underlying persistent volume (PV) data — but volume data and secrets are19**only** captured when the backup plan explicitly enables them (see the flags20below).2122## Attribution2324**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you25MUST read [Usage Attribution](references/attribution.md). For commands executed26directly in the terminal (never in generated scripts, Terraform, or user code),27prefix `gcloud` with28`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:gke-backup-dr)"`29and append `agent-skills/1.0 (skill:gke-backup-dr)` to `User-Agent` headers.3031## CLI Reference3233```bash34# Enable the BackupRestore addon (Slow cluster-level update)35gcloud container clusters update {cluster_name} \36 --update-addons=BackupRestore=ENABLED --location={location} --quiet3738# Create Backup Plan39gcloud beta container backup-restore backup-plans create {plan_name} \40 --project={project_id} --location={location} \41 --cluster=projects/{project_id}/locations/{location}/clusters/{cluster_name} \42 --all-namespaces \43 --include-volume-data --include-secrets \44 --backup-retain-days={days} --cron-schedule="{cron}" --quiet4546# Trigger Manual Backup47gcloud beta container backup-restore backups create {backup_name} \48 --backup-plan={plan_name} --location={location} --quiet4950# Create Restore Plan51gcloud beta container backup-restore restore-plans create {restore_plan_name} \52 --location={location} \53 --cluster=projects/{project_id}/locations/{location}/clusters/{target_cluster_name} \54 --backup-plan=projects/{project_id}/locations/{location}/backupPlans/{source_backup_plan_name} \55 --all-namespaces \56 --cluster-resource-conflict-policy=use-existing-version \57 --namespaced-resource-restore-mode=fail-on-conflict --quiet5859# Execute Restore60gcloud beta container backup-restore restores create {restore_name} \61 --restore-plan={restore_plan_name} --location={location} \62 --backup=projects/{project_id}/locations/{location}/backupPlans/{source_backup_plan_name}/backups/{backup_name} \63 --quiet6465# Verify Restore Status66gcloud beta container backup-restore restores describe {restore_name} \67 --restore-plan={restore_plan_name} --location={location}68```6970> [!WARNING] **`--include-volume-data` and `--include-secrets` BOTH DEFAULT TO71> FALSE.** If you omit them, the backup plan silently produces **config-only72> backups** with no persistent volume snapshots and no Secrets. Always pass both73> flags explicitly when the goal is full workload protection.7475Notes:7677- The `backup-restore` command group requires the `gcloud beta` component78 (`gcloud components install beta`).79- `--cluster` requires the full resource path80 `projects/{project_id}/locations/{location}/clusters/{cluster_name}` (or81 `projects/{project_id}/zones/{zone}/clusters/{cluster_name}` for zonal82 clusters), not a bare cluster name.83- Restore plans require exactly one namespaced-resource scope flag:84 `--all-namespaces`, `--selected-namespaces={ns1},{ns2}`,85 `--excluded-namespaces=...`, `--selected-applications=...`, or86 `--no-namespaces`.8788## Restore Safety (CRITICAL)8990A restore writes into a **live cluster** and, depending on the conflict policy,91can overwrite or delete existing resources:9293- `--cluster-resource-conflict-policy=use-existing-version` keeps existing94 cluster-scoped resources (safe default); `use-backup-version` **deletes**95 the existing version first — deleting a CRD deletes all of its CRs.96- `--namespaced-resource-restore-mode=fail-on-conflict` aborts on any conflict97 (safe default); `merge-skip-on-conflict` skips conflicting resources;98 `merge-replace-on-conflict` and `merge-replace-volume-on-conflict`99 **overwrite** existing resources or volumes; `delete-and-restore` **deletes100 entire conflicting namespaces** (and all resources in them) before101 restoring.102103**Rules:**1041051. Validate the restore in a non-production target cluster first.1062. Prefer the safe defaults (`use-existing-version` + `fail-on-conflict`)107 unless the user explicitly needs to revert live resources.1083. **Always obtain explicit user confirmation before executing a restore into a109 production cluster**, and state which conflict policy is in effect and what110 it may overwrite or delete.111112## Best Practices1131141. **CMEK Encryption**: Encrypt backup plans using Customer-Managed Encryption115 Keys:116 `--encryption-key=projects/{project_id}/locations/{location}/keyRings/{ring}/cryptoKeys/{key}`.1172. **Scope**: Prefer backing up specific namespaces rather than the entire118 cluster: `--selected-namespaces={ns1},{ns2}` (instead of119 `--all-namespaces`).1203. **Application Consistency**: Recommend quiescing the database or pausing121 application writes (e.g. using pre-backup hooks or database-specific tools)122 prior to backups to ensure data integrity.1234. **CSI Volume Snapshots**: Ensure that stateful backups utilize GKE's CSI124 (Container Storage Interface) driver for volume snapshots to capture125 persistent volume data.1265. **Service Terminology**: Always explicitly refer to the service as **Backup127 for GKE** in your response. This distinguishes it from the broader (but128 complementary) Google Cloud **Backup and Disaster Recovery (DR)129 Service**, ## Golden Path Backup Defaults130131The recommended production golden path configuration for Backup for GKE:132133- **Addon**: BackupRestore addon enabled134 (`--update-addons=BackupRestore=ENABLED`).135- **Volume Inclusion**: `--include-volume-data` explicitly passed (enabled,136 since the service default is false).137- **Secret Inclusion**: `--include-secrets` explicitly passed (enabled, since138 the service default is false).139- **Retention**: Defined retention period (e.g. 30 days via140 `--backup-retain-days=30`).141- **Encryption**: CMEK enabled (`--encryption-key=...`).142143## Recent Changes144145- **Cross-project backup and restore (GA)**: Backup plans can store backups in146 a different project than the source cluster, and restore plans can target147 clusters in a third project. Enables centralized backup projects (with148 immutability/retention managed by a platform team) and cross-project149 environment seeding without granting access to the source project.150- **Pricing change (effective 2026-03-02)**: The backup management fee moved151 from **pod-based** to **NAMESPACE-based** pricing — charged per non-system152 namespace in the most recent successful backup of each plan (system153 namespaces like `kube-system` are excluded). Existing committed use discount154 (CUD) holders keep pod-based management pricing until their commitment ends;155 everyone else moves to the new model. See156 https://cloud.google.com/products/backup-for-gke/pricing-changes.157- **Smart Scheduling**: RPO-driven backup scheduling as an alternative to158 fixed cron schedules — pass `--target-rpo-minutes={minutes}` instead of159 `--cron-schedule` when creating the backup plan (optionally with RPO160 exclusion windows via `--exclusion-windows-file`).161- **Hyperdisk support**: Backup and restore of **Hyperdisk ML** and162 **Hyperdisk Balanced High Availability** volumes is supported on GKE163 clusters running **1.33.1-gke.1959000 and later** (Hyperdisk throughput,164 extreme, and balanced types are also supported).165166## Troubleshooting & Common Pitfalls (CRITICAL)167168> [!IMPORTANT] **Slow Operations**: Enabling the BackupRestore addon169> (`--update-addons=BackupRestore=ENABLED`) triggers a slow Google Cloud control170> plane cluster update that takes several minutes. * **Rule**: **Do not run a171> terminal loop waiting for the GKE Backup addon to become active.** *172> **Action**: Provide the command to enable the addon, explain that the173> operation will proceed in the background, and immediately proceed to write the174> backup plan configs. Do not block.