gke-backup-dr
它能做什么
这项技能帮助 AI 智能体配置 Backup for GKE,包括备份计划、恢复计划和加密备份。适合需要保护集群数据并能够恢复的团队。
适用场景
- ✓当你需要为 GKE 集群制定备份策略时。
- ✓当你想在出现问题后恢复 GKE 集群或其工作负载时。
- ✓当你希望使用客户自管密钥加密备份时。
技能链接
https://github.com/google/skills/blob/main/skills/cloud/gke-backup-dr/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我为 GKE 集群设置每日备份,包括卷数据,以便之后可以恢复。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会启用 Backup for GKE 附加组件,然后创建带有计划的备份计划和恢复计划。只有在计划中明确开启时,卷数据和密钥才会被包括在内。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
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-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:
- The
backup-restorecommand group requires thegcloud betacomponent (gcloud components install beta). --clusterrequires the full resource pathprojects/{project_id}/locations/{location}/clusters/{cluster_name}(orprojects/{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-versionkeeps existing cluster-scoped resources (safe default);use-backup-versiondeletes the existing version first — deleting a CRD deletes all of its CRs.--namespaced-resource-restore-mode=fail-on-conflictaborts on any conflict (safe default);merge-skip-on-conflictskips conflicting resources;merge-replace-on-conflictandmerge-replace-volume-on-conflictoverwrite existing resources or volumes;delete-and-restoredeletes 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 Encr
常见问题
卷数据和密钥总会被备份吗?
不会。只有备份计划明确开启时才会捕获。
它涵盖数据库备份吗?
不涵盖。技能说明不要将它用于数据库备份。
备份会保留多长时间?
你可以在备份计划中设置备份保留的天数。
详情
作者的原始描述
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.
repo: google/skills
热度
- GitHub 星标
- 22k
- 排名
- #10278
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
finding-google-skills
22k帮你的智能体为某项设置任务找到合适的 Google 指南,例如托管、数据库、存储、登录或 AI 模型服务。
gcloud
22k帮你的智能体编写并检查 Google Cloud gcloud 命令,在运行任何内容之前查阅准确的语法,避免猜测参数。
google-cloud-recipe-auth
22k引导你的智能体了解 Google Cloud 的身份与访问管理,包括人员和服务如何登录,以及它们各自获得哪些权限。
google-cloud-recipe-onboarding
22k带领新开发者完成在 Google Cloud 上的第一步,包括选择项目、关联计费,以及部署第一个资源。