aidentity / index

google/skills · Apache-2.0

gke-backup-dr

Configures Backup for GKE: the BackupRestore cluster addon, BackupPlan and RestorePlan resources, restore workflows, and CMEK-encrypted backups. Use for backup policies, disaster recovery, or GKE cluster restores. Don't use for database backups.

cloud stable

Contents

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).

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:

  1. Validate the restore in a non-production target cluster first.
  2. Prefer the safe defaults (use-existing-version + fail-on-conflict)

unless the user explicitly needs to revert live resources.

  1. **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

  1. CMEK Encryption: Encrypt backup plans using Customer-Managed Encryption

Keys:

--encryption-key=projects/{project_id}/locations/{location}/keyRings/{ring}/cryptoKeys/{key}.

  1. Scope: Prefer backing up specific namespaces rather than the entire

cluster: --selected-namespaces={ns1},{ns2} (instead of

--all-namespaces).

  1. 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.

  1. CSI Volume Snapshots: Ensure that stateful backups utilize GKE's CSI

(Container Storage Interface) driver for volume snapshots to capture

persistent volume data.

  1. 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.

Provenance

Authored by Google LLC in google/skills. The content is mirrored here under its upstream license.

Related

agent-platform-alert-configuration Configures best-practice alerting policies for AI agents using OpenTelemetry (OTel) metrics, generating output as Terraform (.tf) configuration files. Use when analyzing, writing, or deploying alerting policies to monitor agent latency, error rates, token usage, and quality metrics. Don't use for standard infrastructure monitoring unrelated to AI agents, or when the agent is not instrumented with OpenTelemetry (for Reliability, Cost, Safety, Security alerts). NOTE: Reliability, Cost, Safety, and Security alerts use generic OTel metrics and work across runtimes (such as Cloud Run, Vertex AI). Quality alerts rely on Vertex AI Online Monitors and are strictly bound to Vertex AI deployments. google/skills Apache-2.0 agent-platform-deploy Deploy open models or custom weights from Model Garden to Agent Platform endpoints, check the status of an in-progress deployment operation, or clean up resources by undeploying models and deleting endpoints. Use when asked to actively deploy a model, list the Model Garden CATALOG of available models, check if a specific model is deployable (`gcloud ai model-garden models list-deployment-config`), query deployment cost, troubleshoot deployment errors (like quota limits), or undeploy/clean up endpoints. Also use when copying and deploying a 1P Tuned Model. Don't use for pure listing/discovery questions of the form "is X deployed?", "list my endpoints", or "which regions have models running?" — for those use `agent-platform-endpoint-management`. Don't use for public Vertex AI deployments (use the `vertex-deploy` skill) or for running model evaluations (use the `agent-platform-eval-flywheel` skill). google/skills Apache-2.0 agent-platform-endpoint-management Manages Agent Platform serving endpoints. Use when you need to create, list, describe, update, or delete serving endpoints for model deployment on Agent Platform. Also use when troubleshooting endpoint permission, quota, or resource busy errors. Don't use for deploying models to endpoints or for running model evaluations. google/skills Apache-2.0 agent-platform-eval-flywheel Measures and improves the quality of AI models and agents on Google Cloud using the Eval Quality Flywheel methodology. Use when evaluating an agent or model, building an eval dataset, picking or writing evaluation metrics, analyzing failures, comparing results before and after a fix, or when guidance is needed on Agent Platform eval methodology — including dataset schema, LLM-as-judge scoring, and common failure causes. For fine-tuning, use agent-platform-tuning. For general production deployment, use agent-platform-deploy. google/skills Apache-2.0 agent-platform-inference Connects to and performs inference with Google Cloud Agent Platform GenAI models, including First-Party Gemini models and Third-Party OpenMaaS models (Llama, DeepSeek, Qwen, etc.). Use when asked to perform inference, ask a model a question, run a test prompt, execute chat completions, or generate code for calling Gemini or OpenMaaS models, authenticate with GenAI SDK, OpenAI SDK, or legacy Agent Platform SDK, configure base URLs and global/regional endpoints, or troubleshoot 429 Resource Exhausted (DSQ), 400 User Validation, or 404 Not Found errors. Don't use for deploying models to endpoints or for running model evaluations. google/skills Apache-2.0