gcp-waf-reliability

基于 Google Cloud 架构完善框架的可靠性支柱:定义以用户为中心的 SLO,通过多区域/多可用区冗余消除单点故障,配置水平自动扩缩容,使用 Cloud Monitoring 实现可观测性,采用优雅降级模式,开展灾难恢复测试并实施无责复盘。用于生产就绪评审和 SRE 实践。

仓库最近推送
GitHub Stars
219
Forks
38
Issues / PRs
7

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "gcp-waf-reliability":https://skillpi.com/zh/skills/deepskill-e93516de48eb2ba94e0bb183cc492fc4b3584101a7c85b13b8a09ba219586797。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

基于 Google Cloud 架构完善框架的可靠性支柱:定义以用户为中心的 SLO,通过多区域/多可用区冗余消除单点故障,配置水平自动扩缩容,使用 Cloud Monitoring 实现可观测性,采用优雅降级模式,开展灾难恢复测试并实施无责复盘。用于生产就绪评审和 SRE 实践。

0 下载

介绍来源: third_party · TerminalSkills · 1.0.0 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: gcp-waf-reliability
description: |
  Apply the Google Cloud Well-Architected Framework's Reliability pillar — define
  user-centric SLOs, eliminate single points of failure with multi-zone/region
  redundancy, configure horizontal autoscaling, observability via Cloud
  Monitoring, graceful degradation patterns, DR testing, and blameless
  postmortems. Use for production readiness reviews and SRE practices.
license: Apache-2.0
compatibility: 'gcloud-cli, Cloud Monitoring, Cloud Logging, Backup and DR Service'
metadata:
  author: google-cloud
  version: 1.0.0
  category: devops
  tags:
    - gcp
    - reliability
    - sre
    - well-architected
    - slo

GCP Well-Architected Framework — Reliability

Overview

Reliability is measured by user experience, not infrastructure uptime. A system can be 100% green on the infra dashboard while users see broken checkout — that's the gap SLOs close. This skill applies the Google Cloud Well-Architected Framework's Reliability pillar to design, evaluate, and harden production workloads.

Instructions

Core Principles

Principle What it means
Define reliability via user experience Measure what users feel (request success rate, latency p99, page-load time), not just CPU/disk
Set realistic SLO targets 99.9% is roughly 43 min/month of error budget; 99.99% is 4 min — pick what your business actually needs
Build redundancy No single zone, region, or service should take down the user experience
Scale horizontally More instances, not bigger instances; this is also fault tolerance
Detect via observability Metrics + logs + traces; alert on user-facing symptoms, not on causes
Degrade gracefully Read-only mode, cached responses, queue-and-retry beat hard failures
Test failure recovery Practice failover, restore-from-backup, regional evacuation
Blameless postmortems Document the system flaw that allowed the human error

Defining SLIs and SLOs

# Example SLO definition (managed via gcloud or Terraform)
# SLI: HTTP success rate from the load balancer
# SLO: 99.9% of requests succeed over rolling 28 days
displayName: "Web frontend availability"
serviceLevelIndicator:
  requestBased:
    goodTotalRatio:
      goodServiceFilter: |
        metric.type="loadbalancing.googleapis.com/https/request_count"
        resource.labels.url_map_name="web-frontend"
        metric.labels.response_code_class="200"
      totalServiceFilter: |
        metric.type="loadbalancing.googleapis.com/https/request_count"
        resource.labels.url_map_name="web-frontend"
goal: 0.999
rollingPeriod: 2419200s  # 28 days
# Apply via gcloud
gcloud monitoring services create --service-id=web-frontend \
  --display-name="Web frontend"

gcloud alpha monitoring slos create \
  --service=web-frontend \
  --slo-from-file=availability-slo.yaml

Multi-Zone and Multi-Region Redundancy

# Regional GKE cluster (control plane + nodes across 3 zones)
gcloud container clusters create-auto prod \
  --region=us-central1  # NOT --zone, which is single-zone

# Regional Cloud SQL (synchronous standby in another zone)
gcloud sql instances create orders \
  --availability-type=REGIONAL \
  --region=us-central1

# Regional persistent disks (replicated synchronously across two zones)
gcloud compute disks create app-data \
  --type=pd-balanced --size=500GB \
  --region=us-central1 --replica-zones=us-central1-a,us-central1-b
# Multi-region Cloud Storage (geo-redundant by default)
gcloud storage buckets create gs://my-prod-data \
  --location=US --default-storage-class=STANDARD

For workloads with multi-region SLOs, deploy to two regions behind a global HTTPS load balancer with --load-balancing-scheme=EXTERNAL_MANAGED and use Cloud DNS health checks for failover. Cloud Spanner is the right database when you need synchronous multi-region writes.

Horizontal Autoscaling

# GKE HPA — scale on CPU + custom metrics
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata: { name: api }
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: api
  minReplicas: 3              # never below 3 (one per zone)
  maxReplicas: 50
  metrics:
    - type: Resource
      resource: { name: cpu, target: { type: Utilization, averageUtilization: 70 } }
    - type: External
      external:
        metric:
          name: pubsub.googleapis.com|subscription|num_undelivered_messages
          selector: { matchLabels: { resource.label.subscription_id: events-sub } }
        target: { type: AverageValue, averageValue: "100" }
# Cloud Run autoscaling: minimum instances avoids cold-start pain on critical paths
gcloud run services update api \
  --min-instances=2 --max-instances=100 \
  --concurrency=80 --cpu-boost

Health Checks and Graceful Degradation

# Kubernetes liveness + readiness — readiness gates traffic
livenessProbe:
  httpGet: { path: /healthz, port: 8080 }
  periodSeconds: 10
  failureThreshold: 3
readinessProbe:
  httpGet: { path: /ready, port: 8080 }   # checks DB connection, deps
  periodSeconds: 5
  failureThreshold: 2
startupProbe:
  httpGet: { path: /healthz, port: 8080 }
  failureThreshold: 30
  periodSeconds: 5
# Circuit breaker — degrade gracefully when downstream is slow/failing
from circuitbreaker import circuit

@circuit(failure_threshold=5, recovery_timeout=30)
def fetch_recommendations(user_id):
    return recommendations_service.get(user_id, timeout=2)

def render_homepage(user_id):
    try:
        recs = fetch_recommendations(user_id)
    except Exception:
        recs = cached_default_recommendations()  # graceful fallback
    return template.render(recommendations=recs)

Backup, Restore, and DR Testing

# Backup and DR Service for VMs / GKE / databases
gcloud backup-dr backup-plans create web-tier-plan \
  --location=us-central1 \
  --backup-vault=projects/my-project/locations/us-central1/backupVaults/prod \
  --resource-type=compute.googleapis.com/Instance \
  --backup-rule=rule-id=daily,recurrence=DAILY,retention-days=30 \
  --backup-rule=rule-id=monthly,recurrence=MONTHLY,retention-days=365
# Cloud SQL: enable PITR and test restore quarterly
gcloud sql instances clone orders orders-restore-test \
  --point-in-time='2026-04-15T10:00:00Z'
# Validate the clone, then delete it — proves backups are actually restorable

DR testing is not optional. Schedule quarterly:

  • Game days: simulate a regional outage; force traffic to the secondary region
  • Restore drills: clone a production DB to a non-prod project from backup, validate row counts and known queries
  • Failure injection: kill a random pod / zone / dependency in staging; verify SLO holds

Alerting on Symptoms, Not Causes

# Bad: alerts on CPU usage. Good: alerts on user-facing error rate.
displayName: "High error rate — web-frontend"
conditions:
  - displayName: "Error rate > 1% for 5 minutes"
    conditionThreshold:
      filter: |
        metric.type="loadbalancing.googleapis.com/https/request_count"
        resource.labels.url_map_name="web-frontend"
        metric.labels.response_code_class!="200"
      comparison: COMPARISON_GT
      thresholdValue: 0.01
      duration: 300s
notificationChannels:
  - projects/my-project/notificationChannels/oncall-pagerduty

Page on:

  • SLO burn rate (e.g., 14.4× over 1h, 6× over 6h — Google's multi-window strategy)
  • User-facing error rate
  • Latency p99 above SLO

Don't page on:

  • CPU above 80% (autoscaling handles this)
  • Disk above 80% (alert someone, but not on-call)
  • Single-instance health (the load balancer handles this)

Validation Checklist

  • [ ] User-focused SLIs/SLOs explicitly defined and dashboarded
  • [ ] No single zone — every tier is regional (GKE regional cluster, Cloud SQL HA, regional PDs, multi-region GCS)
  • [ ] Autoscaling enabled with min ≥ 3 (one per zone) and a concrete max
  • [ ] Liveness + readiness + startup probes configured for all critical pods
  • [ ] Health checks trigger automated failover at the load balancer level
  • [ ] PodDisruptionBudgets for every Deployment serving traffic
  • [ ] Backups are scheduled AND restored at least quarterly
  • [ ] Graceful degradation patterns in place (circuit breakers, retries with exponential backoff, rate limiting)
  • [ ] Game days / chaos engineering run regularly
  • [ ] Blameless postmortem template + tracking system exists and is used

    Examples

Example 1 — Production readiness review for a new service

User wants to ship a payments API. Walk through: defined SLOs (99.95% success, p99 < 500ms), regional GKE Autopilot cluster, Cloud SQL with availability-type=REGIONAL, HPA min=3 max=30, PDB minAvailable=2, readiness probe checking DB connectivity, alerting on SLO burn rate (not CPU), Backup-and-DR daily snapshots, and a quarterly restore drill on the calendar. Block ship if any of those are missing.

Example 2 — Diagnose unreliability complaints despite green dashboards

User reports "users say checkout is broken but our infra dashboards are all green." Audit: alerts are on CPU and disk usage (causes), not on HTTP 5xx rate (symptom). Wire up an SLO on payment success rate, set up multi-window burn-rate alerts (14.4× / 6× / 3× / 1×), and discover a 0.4% baseline error from a flaky third-party that was invisible until measured. Recommend retries with jitter + circuit breaker for graceful degradation.

Guidelines

  • SLOs measure user experience — pick metrics from the load balancer or app, not from the kernel
  • Default to regional everything; single-zone is dev-only
  • Min replicas ≥ 3 for any tier behind a regional load balancer
  • Alert on symptoms, not causes — a CPU alert wakes the wrong person
  • Use multi-window burn-rate alerts (Google SRE workbook approach), not simple thresholds
  • Test failure recovery quarterly — backups you've never restored aren't backups
  • PodDisruptionBudgets prevent autoscaler / upgrade rollouts from breaking SLOs
  • For graceful degradation, ship with circuit breakers, retries with exponential backoff + jitter, and read-only fallbacks
  • Blameless postmortems focus on the system flaw — humans will keep making mistakes; the system shouldn't let them cause outages
  • For multi-region SLOs, use Cloud Spanner / multi-region GCS / global HTTPS LB; resist the urge to shard yourself

当前收录版本

1.0.0

核对来源版本 ↗

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值92/100

亮点

  • 面向生产环境的可靠性工程实践,直接解决SRE核心痛点
  • 提供完整的GCP可靠性支柱实施框架
  • 包含可落地的SLO定义、多区域冗余、自动扩缩容等关键能力
触发精准88/100

亮点

  • 触发词精准完整,覆盖多种变体,边界清晰
  • description明确指向GCP可靠性支柱应用场景
  • 兼容组件声明准确,便于用户识别适用性
结构规范95/100

亮点

  • Phase/步骤清晰,有出口条件,含端到端示例
  • frontmatter完整,单文件结构良好
  • 提供完整的验证清单和实际案例
执行可靠90/100

亮点

  • 工具来源明确,参数正确,覆盖主要异常
  • 不可逆操作有确认机制
  • 提供完整的灾难恢复测试和备份验证流程
证据可验 (前四项均值)91/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。