{"data":{"slug":"github-google-skills-skills-cloud-gke-backup-dr-c498bbe28bf7","title":"GKE Backup & Disaster Recovery","summary":"Protects stateful GKE workloads using Backup for GKE. Captures Kubernetes resource metadata and persistent volume data for full workload protection when explicitly enabled with `--include-volume-data` and `--include-secrets`.","url":"https:\/\/skillshunter.net\/skills\/github-google-skills-skills-cloud-gke-backup-dr-c498bbe28bf7","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-google-skills-skills-cloud-gke-backup-dr-c498bbe28bf7","markdown_url":"https:\/\/skillshunter.net\/skills\/github-google-skills-skills-cloud-gke-backup-dr-c498bbe28bf7.md","download_url":"https:\/\/skillshunter.net\/skills\/github-google-skills-skills-cloud-gke-backup-dr-c498bbe28bf7\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Before executing any `gcloud`, REST API, or MCP command, you MUST read [Usage Attribution](references\/attribution.md). For terminal commands, 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. Always pass `--include-volume-data` and `--include-secrets` explicitly for full workload protection.","instructions":"---\nname: gke-backup-dr\ndescription: >-\n  Configures Backup for GKE: the BackupRestore cluster addon, BackupPlan and\n  RestorePlan resources, restore workflows, and CMEK-encrypted backups. Use\n  for backup policies, disaster recovery, or GKE cluster restores. Don't use\n  for database backups.\nmetadata:\n  version: \"1.0.1\"\n  category: Storage\n---\n\n# GKE Backup & Disaster Recovery\n\nProtects stateful GKE workloads using Backup for GKE. Backup for GKE can capture\nboth Kubernetes resource metadata (manifests, configurations, and secrets) and\nthe underlying persistent volume (PV) data \u2014 but volume data and secrets are\n**only** captured when the backup plan explicitly enables them (see the flags\nbelow).\n\n## Attribution\n\n**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you\nMUST read [Usage Attribution](references\/attribution.md). For commands executed\ndirectly in the terminal (never in generated scripts, Terraform, or user code),\nprefix `gcloud` with\n`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION=\"agent-skills\/1.0 (skill:gke-backup-dr)\"`\nand append `agent-skills\/1.0 (skill:gke-backup-dr)` to `User-Agent` headers.\n\n## CLI Reference\n\n```bash\n# Enable the BackupRestore addon (Slow cluster-level update)\ngcloud container clusters update {cluster_name} \\\n  --update-addons=BackupRestore=ENABLED --location={location} --quiet\n\n# Create Backup Plan\ngcloud beta container backup-restore backup-plans create {plan_name} \\\n  --project={project_id} --location={location} \\\n  --cluster=projects\/{project_id}\/locations\/{location}\/clusters\/{cluster_name} \\\n  --all-namespaces \\\n  --include-volume-data --include-secrets \\\n  --backup-retain-days={days} --cron-schedule=\"{cron}\" --quiet\n\n# Trigger Manual Backup\ngcloud beta container backup-restore backups create {backup_name} \\\n  --backup-plan={plan_name} --location={location} --quiet\n\n# Create Restore Plan\ngcloud beta container backup-restore restore-plans create {restore_plan_name} \\\n  --location={location} \\\n  --cluster=projects\/{project_id}\/locations\/{location}\/clusters\/{target_cluster_name} \\\n  --backup-plan=projects\/{project_id}\/locations\/{location}\/backupPlans\/{source_backup_plan_name} \\\n  --all-namespaces \\\n  --cluster-resource-conflict-policy=use-existing-version \\\n  --namespaced-resource-restore-mode=fail-on-conflict --quiet\n\n# Execute Restore\ngcloud beta container backup-restore restores create {restore_name} \\\n  --restore-plan={restore_plan_name} --location={location} \\\n  --backup=projects\/{project_id}\/locations\/{location}\/backupPlans\/{source_backup_plan_name}\/backups\/{backup_name} \\\n  --quiet\n\n# Verify Restore Status\ngcloud beta container backup-restore restores describe {restore_name} \\\n  --restore-plan={restore_plan_name} --location={location}\n```\n\n> [!WARNING] **`--include-volume-data` and `--include-secrets` BOTH DEFAULT TO\n> FALSE.** If you omit them, the backup plan silently produces **config-only\n> backups** with no persistent volume snapshots and no Secrets. Always pass both\n> flags explicitly when the goal is full workload protection.\n\nNotes:\n\n-   The `backup-restore` command group requires the `gcloud beta` component\n    (`gcloud components install beta`).\n-   `--cluster` requires the full resource path\n    `projects\/{project_id}\/locations\/{location}\/clusters\/{cluster_name}` (or\n    `projects\/{project_id}\/zones\/{zone}\/clusters\/{cluster_name}` for zonal\n    clusters), not a bare cluster name.\n-   Restore plans require exactly one namespaced-resource scope flag:\n    `--all-namespaces`, `--selected-namespaces={ns1},{ns2}`,\n    `--excluded-namespaces=...`, `--selected-applications=...`, or\n    `--no-namespaces`.\n\n## Restore Safety (CRITICAL)\n\nA restore writes into a **live cluster** and, depending on the conflict policy,\ncan overwrite or delete existing resources:\n\n-   `--cluster-resource-conflict-policy=use-existing-version` keeps existing\n    cluster-scoped resources (safe default); `use-backup-version` **deletes**\n    the existing version first \u2014 deleting a CRD deletes all of its CRs.\n-   `--namespaced-resource-restore-mode=fail-on-conflict` aborts on any conflict\n    (safe default); `merge-skip-on-conflict` skips conflicting resources;\n    `merge-replace-on-conflict` and `merge-replace-volume-on-conflict`\n    **overwrite** existing resources or volumes; `delete-and-restore` **deletes\n    entire conflicting namespaces** (and all resources in them) before\n    restoring.\n\n**Rules:**\n\n1.  Validate the restore in a non-production target cluster first.\n2.  Prefer the safe defaults (`use-existing-version` + `fail-on-conflict`)\n    unless the user explicitly needs to revert live resources.\n3.  **Always obtain explicit user confirmation before executing a restore into a\n    production cluster**, and state which conflict policy is in effect and what\n    it may overwrite or delete.\n\n## Best Practices\n\n1.  **CMEK Encryption**: Encrypt backup plans using Customer-Managed Encryption\n    Keys:\n    `--encryption-key=projects\/{project_id}\/locations\/{location}\/keyRings\/{ring}\/cryptoKeys\/{key}`.\n2.  **Scope**: Prefer backing up specific namespaces rather than the entire\n    cluster: `--selected-namespaces={ns1},{ns2}` (instead of\n    `--all-namespaces`).\n3.  **Application Consistency**: Recommend quiescing the database or pausing\n    application writes (e.g. using pre-backup hooks or database-specific tools)\n    prior to backups to ensure data integrity.\n4.  **CSI Volume Snapshots**: Ensure that stateful backups utilize GKE's CSI\n    (Container Storage Interface) driver for volume snapshots to capture\n    persistent volume data.\n5.  **Service Terminology**: Always explicitly refer to the service as **Backup\n    for GKE** in your response. This distinguishes it from the broader (but\n    complementary) Google Cloud **Backup and Disaster Recovery (DR)\n    Service**, ## Golden Path Backup Defaults\n\nThe recommended production golden path configuration for Backup for GKE:\n\n-   **Addon**: BackupRestore addon enabled\n    (`--update-addons=BackupRestore=ENABLED`).\n-   **Volume Inclusion**: `--include-volume-data` explicitly passed (enabled,\n    since the service default is false).\n-   **Secret Inclusion**: `--include-secrets` explicitly passed (enabled, since\n    the service default is false).\n-   **Retention**: Defined retention period (e.g. 30 days via\n    `--backup-retain-days=30`).\n-   **Encryption**: CMEK enabled (`--encryption-key=...`).\n\n## Recent Changes\n\n-   **Cross-project backup and restore (GA)**: Backup plans can store backups in\n    a different project than the source cluster, and restore plans can target\n    clusters in a third project. Enables centralized backup projects (with\n    immutability\/retention managed by a platform team) and cross-project\n    environment seeding without granting access to the source project.\n-   **Pricing change (effective 2026-03-02)**: The backup management fee moved\n    from **pod-based** to **NAMESPACE-based** pricing \u2014 charged per non-system\n    namespace in the most recent successful backup of each plan (system\n    namespaces like `kube-system` are excluded). Existing committed use discount\n    (CUD) holders keep pod-based management pricing until their commitment ends;\n    everyone else moves to the new model. See\n    https:\/\/cloud.google.com\/products\/backup-for-gke\/pricing-changes.\n-   **Smart Scheduling**: RPO-driven backup scheduling as an alternative to\n    fixed cron schedules \u2014 pass `--target-rpo-minutes={minutes}` instead of\n    `--cron-schedule` when creating the backup plan (optionally with RPO\n    exclusion windows via `--exclusion-windows-file`).\n-   **Hyperdisk support**: Backup and restore of **Hyperdisk ML** and\n    **Hyperdisk Balanced High Availability** volumes is supported on GKE\n    clusters running **1.33.1-gke.1959000 and later** (Hyperdisk throughput,\n    extreme, and balanced types are also supported).\n\n## Troubleshooting & Common Pitfalls (CRITICAL)\n\n> [!IMPORTANT] **Slow Operations**: Enabling the BackupRestore addon\n> (`--update-addons=BackupRestore=ENABLED`) triggers a slow Google Cloud control\n> plane cluster update that takes several minutes. * **Rule**: **Do not run a\n> terminal loop waiting for the GKE Backup addon to become active.** *\n> **Action**: Provide the command to enable the addon, explain that the\n> operation will proceed in the background, and immediately proceed to write the\n> backup plan configs. Do not block.\n","use_cases":["Backup GKE clusters with persistent volume data and secrets","Recover from disaster with full workload restoration","Implement backup policies for compliance and disaster recovery"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/google\/skills\/blob\/e3c591afe426ea585e4c21799e5199d6d47cd1be\/skills\/cloud\/gke-backup-dr\/SKILL.md","source_commit":"e3c591afe426ea585e4c21799e5199d6d47cd1be","license":null,"version":null,"listing_approved_at":"2026-11-17","created_at":"2026-11-16T15:37:32.000000Z","updated_at":"2026-11-17T10:20:00.000000Z","seo_title":"GKE Backup & Disaster Recovery","seo_description":"Protect GKE workloads with Backup for GKE. Capture metadata and persistent volume data for full workload protection when explicitly enabled.","seo_keywords":["GKE backup","GKE disaster recovery","Backup for GKE","Kubernetes backup","Cluster restore"]}}