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.
Written by Google and published in google/skills under the Apache-2.0 license. Treq shows it unchanged except for heading levels and links to files on GitHub.
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).
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.
# 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-dataand--include-secretsBOTH 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:
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.--all-namespaces, --selected-namespaces={ns1},{ns2},
--excluded-namespaces=..., --selected-applications=..., or
--no-namespaces.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:
use-existing-version + fail-on-conflict)
unless the user explicitly needs to revert live resources.--encryption-key=projects/{project_id}/locations/{location}/keyRings/{ring}/cryptoKeys/{key}.--selected-namespaces={ns1},{ns2} (instead of
--all-namespaces).The recommended production golden path configuration for Backup for GKE:
--update-addons=BackupRestore=ENABLED).--include-volume-data explicitly passed (enabled,
since the service default is false).--include-secrets explicitly passed (enabled, since
the service default is false).--backup-retain-days=30).--encryption-key=...).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.--target-rpo-minutes={minutes} instead of
--cron-schedule when creating the backup plan (optionally with RPO
exclusion windows via --exclusion-windows-file).[!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.
Claude Code and Codex keep each installed skill's name and description in context. When a request matches the description, the agent loads the full SKILL.md. You can also run it yourself: type /gke-backup-dr in Claude Code or $gke-backup-dr in Codex.
The description says when to use it:
Use for backup policies, disaster recovery, or GKE cluster restores.
Copy the gke-backup-dr folder into .claude/skills/ in your project. To use it in every project, copy it into ~/.claude/skills/ instead.
git clone --depth 1 https://github.com/google/skills.git /tmp/google-skills
mkdir -p .claude/skills
cp -r /tmp/google-skills/skills/cloud/gke-backup-dr .claude/skills/
Codex reads skills from .agents/skills/ in your repository, and from ~/.agents/skills/ for every repository. It detects new skills on its own. Restart Codex if gke-backup-dr does not appear.
git clone --depth 1 https://github.com/google/skills.git /tmp/google-skills
mkdir -p .agents/skills
cp -r /tmp/google-skills/skills/cloud/gke-backup-dr .agents/skills/
Open Settings and select the Skills tab. The tab appears when Skills installation is on under Settings → Feature Preview. Search for gke-backup-dr and choose Install….
Install for repository writes the skill under .treq/skills/ in the current repository. Install for application makes it available to every repository on this machine. Each new workspace gets a copy in .claude/skills/ and .agents/skills/, so Claude Code and Codex both find it. See Installing Skills from the Library.
gke-backup-dr ships 2 files, 10.0 KB in total. Select a file to load it from GitHub.