AGENT SKILL

gke-reliability

Workflows for ensuring high availability and reliability of GKE workloads. Use for PodDisruptionBudgets, replica counts, probes, zone spread and topology design reviews. For a "what is failing" or "is it healthy" question use workload-triage-scan instead.

License 许可
Apache-2.0
最近更新
2026-11-14
Stars
★ 126
Forks
44

01 前言 Front Matter

name
gke-reliability
description
Workflows for ensuring high availability and reliability of GKE workloads. Use for PodDisruptionBudgets, replica counts, probes, zone spread and topology design reviews. For a "what is failing" or "is it healthy" question use workload-triage-scan instead.

03 SKILL.md 正文

GKE Reliability Skill

This skill provides workflows for configuring your GKE cluster and workloads for high availability and reliability.

You are read-only: each change below is a proposal you report with your findings, never a command you run.

Workflows

1. Verify Cluster High Availability

Check if the cluster is regional or has multi-zonal node pools.

Command:

gcloud container clusters describe <cluster-name> --region <region> --format="json(location, locations)"

If location is a region (e.g., us-central1), the control plane is regional. If locations has multiple entries, nodes are spread across multiple zones.

2. Configure Pod Disruption Budgets (PDB)

PDBs ensure that a minimum number of pods are available during voluntary disruptions (like node upgrades).

Check existing PDBs:

kubectl get pdb -n <namespace>

Assess drain exposure (a missing PDB is not, on its own, a workload that "won't survive a drain"):

kubectl get pods -n <namespace> -l <selector> -o wide
  • State the observed placement: replica count and pods per node (3 pods on 3 nodes).
  • Say a single drain evicts only the pods on the drained node; replicas elsewhere keep running.
  • Frame a missing PDB as unprotected during voluntary disruptions such as node-pool upgrades and autoscaler scale-downs: back-to-back drains can evict the next replica before its replacement is Ready.
  • Flag co-location separately: with no pod anti-affinity or topology spread, a reschedule can put replicas on one node, and one drain then takes them all.

Example Manifest:

apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
  name: my-app-pdb
spec:
  maxUnavailable: 1 # never minAvailable: it can block every drain
  selector:
    matchLabels:
      app: my-app

3. Configure Health Probes

Ensure all production containers have Liveness, Readiness, and optionally Startup probes.

  • Readiness Probe: Determines when a container is ready to start accepting traffic.
  • Liveness Probe: Determines when to restart a container.
  • Startup Probe: Disables liveness and readiness checks until the app has started up.

Check workload probes:

kubectl get deployment <app-name> -n <namespace> -o yaml | grep -E "livenessProbe|readinessProbe|startupProbe"

4. Graceful Shutdown

Ensure applications handle SIGTERM signals gracefully and have an appropriate terminationGracePeriodSeconds set (default is 30s).

5. Topology Spread Constraints

Ensure pods are spread across zones or nodes to avoid correlated failures.

Example Manifest excerpt:

spec:
  topologySpreadConstraints:
    - maxSkew: 1
      topologyKey: topology.kubernetes.io/zone
      whenUnsatisfiable: DoNotSchedule # or ScheduleAnyway
      labelSelector:
        matchLabels:
          app: my-app

6. Maintenance Windows and Exclusions

Configure when GKE can perform automated upgrades to avoid peak hours.

Maintenance window: propose a recurring window with a start time, an end time and a FREQ=DAILY recurrence (Config Connector ContainerCluster field spec.maintenancePolicy.recurringWindow).

Best Practices

  1. Regional Clusters: Always use regional clusters for production workloads to survive zone failures.
  2. Probes for All Containers: Every container in a production pod should have at least a readiness probe.
  3. PDBs for Critical Apps: Use PDBs to prevent downtime during automated node upgrades.
  4. Zone Spreading: Always use topologySpreadConstraints to ensure pods are distributed across zones, even in regional clusters.
  5. Schedule Maintenance: Set maintenance windows to ensure upgrades happen during low-traffic periods.

04 同仓库更多 Skills

gke-labs
gke-labs/kube-agents

gke-workload-troubleshooting

Diagnoses GKE workload failures (CrashLoopBackOff, OOMKilled, ImagePullBackOff, Pending, etc.) via logs and events. Use when pods fail to start or crash repeatedly. Don't use for GKE cluster infrastructure provisioning, node pool creation, or non-Kubernetes Google Cloud services.

★ 126
gke-labs
gke-labs/kube-agents

gke-workload-security

Audits, configures, and hardens workload-level security controls for Google Kubernetes Engine (GKE) applications and namespaces. Covers running security audits (`audit_cluster.sh`), enforcing Network Policies (default-deny and Dataplane V2 logging), isolating high-risk pods inside GKE Sandbox (`gVisor`), enforcing Pod Security Standards (`restricted` labeling) and pod securityContext, and mounting Secret Manager secrets via CSI (`SecretProviderClass`). Use when auditing workload security posture, isolating namespaces, applying pod security standards, or configuring network policies and secret volume mounts. Don't use for Workload Identity (use gke-workload-identity), cluster-wide control plane security, RBAC hardening, Binary Authorization, Shielded Nodes, or enabling platform-level GKE add-ons (use gke-platform-security instead).

★ 126
gke-labs
gke-labs/kube-agents

gke-workload-scaling

Manages scaling for GKE workloads using HPA and VPA. Use when configuring Horizontal Pod Autoscaler (HPA), configuring Vertical Pod Autoscaler (VPA), or applying best practices for GKE workload autoscaling. Do not use for cluster-level autoscaling (Cluster Autoscaler), static cluster sizing, or configuring node-level machine styles directly.

★ 126
gke-labs
gke-labs/kube-agents

gke-workload-identity

Configures and diagnoses Workload Identity Federation for GKE authentication failures for Pods (403 "iam.serviceAccounts.getAccessToken" / permission denied, "could not find default credentials", or GKE metadata server unreachable) by verifying cluster and node-pool Workload Identity configuration, the Kubernetes ServiceAccount (KSA) to IAM binding (direct principal binding and legacy Google ServiceAccount impersonation), target-resource IAM roles, and gke-metadata-server health. Use when setting up KSA/GSA bindings (`roles/iam.workloadIdentityUser`, `iam.gke.io/gcp-service-account`) or when a Pod cannot authenticate to Google Cloud APIs. Don't use for in-cluster Kubernetes RBAC errors (API-server authorization), general workload crashes (use gke-workload-troubleshooting), or Pod Security Standards and NetworkPolicies (use gke-workload-security).

★ 126
gke-labs
gke-labs/kube-agents

gke-upgrades

Plans, executes, and validates Google Kubernetes Engine (GKE) cluster upgrades and maintenance operations for both Standard and Autopilot clusters. Produces upgrade plans, pre/post-upgrade checklists, maintenance runbooks with gcloud commands, release channel strategy, and troubleshooting guides. Handles node pool upgrade strategies (surge, blue-green), version compatibility, PDB management, and workload-specific concerns (stateful, GPU, operators). Use this skill whenever the user mentions GKE upgrades, Kubernetes version bumps, node pool maintenance, GKE patching, cluster version management, release channel selection, maintenance windows, surge upgrades, stuck upgrades, or any GKE lifecycle management task — even casual mentions like "we need to upgrade our clusters" or "plan our next GKE maintenance" or "our upgrade is stuck." Don't use for GKE cluster creation, application onboarding, general networking/routing setup, or security policy configurations (use gke-basics or relevant GKE skills instead).

★ 126
gke-labs
gke-labs/kube-agents

gke-tpu-metrics-monitoring

Monitors and troubleshoots GKE TPU workloads, nodes, and node pools using GKE system metrics and PromQL. Use when monitoring TensorCore duty cycle, TPU memory, node readiness, multi-host TPU node pool availability, host maintenance or preemption interruptions, and calculating MTTR or MTBI metrics for GKE TPUs. Don't use for general non-TPU GKE workload monitoring or non-metric TPU debugging.

★ 126