gke-ai-troubleshooting-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.
- License 许可
- Apache-2.0
- 所属仓库
- google/skills
- 最近更新
- 2026-11-14
- Stars
- ★ 2.4w
- Forks
- 2.0k
01 前言 Front Matter
- name
- gke-ai-troubleshooting-tpu-metrics-monitoring
- metadata
- { "version": "1.0.1", "category": "CloudObservabilityAndMonitoring" }
- description
- 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.
02 资源文件 3
- 参考文档references/attribution.md1.9 KB
- 参考文档references/failure_signatures.md1.4 KB
- 脚本scripts/validate_queries.sh348 B
03 SKILL.md 正文
GKE TPU Metrics Monitoring Guide
This skill enables the agent to monitor GKE TPU workloads, nodes, and node pools using GKE system metrics. It helps diagnose if workload interruptions or performance issues are caused by underlying infrastructure.
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-ai-troubleshooting-tpu-metrics-monitoring)"
and append agent-skills/1.0 (skill:gke-ai-troubleshooting-tpu-metrics-monitoring) to User-Agent headers.
Step 0: Mandatory Context
Independently gather required context (such as cluster details or node pool names) using available GKE and Cloud tools, or use the provided {variable} placeholders:
{project_id}: The GCP Project ID.{cluster_name}: The GKE Cluster Name.{location}: The GKE Cluster Location (region or zone).{node_name}: (Optional) The name of the specific GKE node.{node_pool_name}: (Optional) The name of the GKE node pool.
Diagnostic Steps
Step 1: Verify TPU Runtime Metrics Configuration [Low Risk] [Auto]
Before analyzing runtime metrics, verify that the workload is configured to export them. This ensures the cluster and container environment are set up for automated metric scraping and visibility into accelerator health.
- Action: Verify that the Pod specification and cluster meet the following prerequisites:
containerPort: 8431exposed on the TPU container (required for Prometheus metric scraping).- JAX version
0.4.14or later if using JAX (earlier versions do not export runtime metrics). - GKE version is
1.27.4-gke.900or later (required for TPU runtime metric support). - GKE System Metrics are enabled on the cluster (required for Cloud Monitoring ingestion).
Step 2: Monitor TPU Runtime Metrics [Low Risk] [Auto]
If configured correctly, the following metrics are available in Cloud Monitoring (monitored resources k8s_node and k8s_container):
- Container Metrics:
kubernetes.io/container/accelerator/duty_cycle: Percentage of time over the past sampling period (60 seconds) during which the TensorCores were actively processing on a TPU chip.kubernetes.io/container/accelerator/memory_used: Amount of accelerator memory allocated in bytes.kubernetes.io/container/accelerator/memory_total: Total accelerator memory in bytes.
- Node Metrics:
kubernetes.io/node/accelerator/duty_cyclekubernetes.io/node/accelerator/memory_usedkubernetes.io/node/accelerator/memory_total
Step 3: Check Node Status Condition [Low Risk] [Auto]
Query the status condition of GKE nodes (GKE version 1.32.1-gke.1357001 or later).
- PromQL Query (Check if a specific node is Ready):
kubernetes_io:node_status_condition{monitored_resource="k8s_node", cluster_name="{cluster_name}", node_name="{node_name}", condition="Ready", status="True"} - PromQL Query (List nodes with non-Ready conditions that are True):
kubernetes_io:node_status_condition{monitored_resource="k8s_node", cluster_name="{cluster_name}", condition!="Ready", status="True"} - PromQL Query (List nodes that are NOT Ready):
kubernetes_io:node_status_condition{monitored_resource="k8s_node", cluster_name="{cluster_name}", condition="Ready", status="False"} - PromQL Query (Fleet-wide node status):
avg by (condition,status)(avg_over_time(kubernetes_io:node_status_condition{monitored_resource="k8s_node"}[5m]))
Step 4: Check Node Pool Status [Low Risk] [Auto]
Query the status of multi-host TPU node pools.
- PromQL Query (Verify if a specific node pool is Running):
kubernetes_io:node_pool_status{monitored_resource="k8s_node_pool", cluster_name="{cluster_name}", node_pool_name="{node_pool_name}", status="Running"} - PromQL Query (Monitor node pools grouped by status):
Possible statuses:count by (status)(count_over_time(kubernetes_io:node_pool_status{monitored_resource="k8s_node_pool"}[5m]))Provisioning,Running,Error,Reconciling,Stopping.
Step 5: Check Node Pool Availability [Low Risk] [Auto]
Query if all nodes in a multi-host TPU node pool are available.
- PromQL Query (Check availability over time):
Value:avg by (node_pool_name)(avg_over_time(kubernetes_io:node_pool_multi_host_available{monitored_resource="k8s_node_pool", cluster_name="{cluster_name}"}[5m]))1(True, all nodes available) or0(False, some nodes unavailable).
Step 6: Analyze Node Interruptions [Low Risk] [Auto]
Query the count of interruptions for GKE nodes.
- PromQL Query (Breakdown of interruptions and causes):
Interruption Types:sum by (interruption_type,interruption_reason)(sum_over_time(kubernetes_io:node_interruption_count{monitored_resource="k8s_node"}[5m]))TerminationEvent,MaintenanceEvent,PreemptionEvent. Interruption Reasons:HostError,Eviction,AutoRepair. - PromQL Query (Filter for Host Maintenance events):
sum by (interruption_type,interruption_reason)(sum_over_time(kubernetes_io:node_interruption_count{monitored_resource="k8s_node", interruption_reason="HW/SW Maintenance"}[5m])) - PromQL Query (Interruption count aggregated by node pool):
sum by (node_pool_name,interruption_type,interruption_reason)(sum_over_time(kubernetes_io:node_pool_interruption_count{monitored_resource="k8s_node_pool", interruption_reason="HW/SW Maintenance", node_pool_name="{node_pool_name}"}[5m]))
Step 7: Calculate Recovery and Interruption Metrics [Low Risk] [Auto]
Calculate Mean Time to Recovery (MTTR) and Mean Time Between Interruptions (MTBI) over the last 7 days.
- PromQL Query (MTTR - Mean Time to Recovery):
sum(sum_over_time(kubernetes_io:node_pool_accelerator_times_to_recover_sum{monitored_resource="k8s_node_pool", cluster_name="{cluster_name}"}[7d])) / sum(sum_over_time(kubernetes_io:node_pool_accelerator_times_to_recover_count{monitored_resource="k8s_node_pool",cluster_name="{cluster_name}"}[7d])) - PromQL Query (MTBI - Mean Time Between Interruptions):
sum(count_over_time(kubernetes_io:node_memory_total_bytes{monitored_resource="k8s_node", node_name=~"gke-tpu.*|gk3-tpu.*", cluster_name="{cluster_name}"}[7d])) / sum(sum_over_time(kubernetes_io:node_interruption_count{monitored_resource="k8s_node", node_name=~"gke-tpu.*|gk3-tpu.*", cluster_name="{cluster_name}"}[7d]))
Step 8: Monitor TPU Host Metrics [Low Risk] [Auto]
For GKE version 1.28.1-gke.1066000 or later, monitor TPU host performance.
- Container Metrics:
kubernetes.io/container/accelerator/tensorcore_utilization: Current percentage of the TensorCore that is utilized.kubernetes.io/container/accelerator/memory_bandwidth_utilization: Current percentage of the accelerator memory bandwidth that is being used.
- Node Metrics:
kubernetes.io/node/accelerator/tensorcore_utilizationkubernetes.io/node/accelerator/memory_bandwidth_utilization
04 同仓库更多 Skills
sign-in-with-google-web
Implement, configure, and secure Sign In With Google (SiwG) using Google Identity Services (GIS / `https://accounts.google.com/gsi/client`) across web architectures. Use when creating Google sign-in buttons, implementing Google One Tap with FedCM, integrating GIS in React/Next.js/Angular/HTML, verifying ID tokens on backend runtimes (Python/Node.js/Go/Java), enforcing Google Workspace domain restrictions (`hd`), securing client-side ID tokens via WebCrypto nonces or encrypted IndexedDB, embedding in cross-origin iframes via the Intermediate Iframe API (`https://accounts.google.com/gsi/intermediate`), configuring Content Security Policy (CSP), COOP, and Permissions Policy (`identity-credentials-get`) headers, or handling sign-out and revocation. Don't use for legacy Google Sign-In (`gapi.auth2`), Google Cloud IAM service accounts, or Android/iOS native Credential Manager.
dpop-adoption
Implement and debug OAuth 2.0 DPoP (RFC 9449) refresh token sender-constraining for WebCrypto, Node.js ES6, and browser runtimes integrating with Google's OAuth platform. Use when configuring non-extractable asymmetric key pairs (P-256), generating DPoP Proof JWTs for authorization code exchange and token refresh, or handling 400 use_dpop_nonce challenge retry loops at oauth2.googleapis.com/token. Don't use for unconstrained OAuth 2.0 flows (where refresh tokens are not bound to a client key pair), or for Google Cloud IAM / service account authentication.
retrieving-developer-knowledge
Searches, retrieves, and synthesizes official Google developer documentation across Google Cloud, AI/Gemini, Android, Chrome, Web, Flutter, Go, Firebase, and other Google developer platforms. Integrates with the Developer Knowledge MCP server (search_documents, get_documents, answer_query) or the Developer Knowledge REST API fallback. Use when searching for gcloud CLI commands, API syntax, IAM permissions, official documentation, architectural comparisons, or product choice overviews. Don't use for local filesystem lookups or non-Google documentation.
migrate-to-rust
Clones, analyzes, plans, and migrates legacy codebases (C++, Fortran, Java, Python, C, Shell) from a GitHub URL or local directory to a modern, high-performance, deterministic, 100% Safe Rust architecture, tracking live telemetry across every task bucket, test failure/fix cycle, and Profile-Guided Optimization (PGO) stage, and producing a first-person AI storytelling report and interactive HTML infographic. Use when migrating a GitHub repository or local codebase to Rust, porting legacy C++, Fortran, Python, or Java workloads to memory-safe Rust, designing Struct-of-Arrays (SoA) or SIMD Rust architectures, or optimizing Rust ports with LLVM PGO. Don't use for unrelated non-Rust refactoring or single-line syntax questions.
finding-google-skills
Google platform decision and setup guidance, loaded on demand from Google's skill catalog. Use when a developer is choosing or setting up part of their stack, such as where to run a service, a database, storage, messaging, authentication, analytics, ads, or AI model serving, and a Google product is a reasonable candidate - whether or not a vendor is named - or when a request names a Google product or API. Brings in the matching Google skill so the answer can weigh Google options, their trade-offs, and when they are not the right fit. Skip when the stack is already settled on another provider and no Google product is named, or the task involves no platform choice.
workload-manager-basics
Use this skill to manage Google Cloud Workload Manager evaluations, rules, scanned resources, and validation results by using public client libraries and the REST API. Use when you need to inspect workload best-practice rules, create and run evaluations for Google Cloud general best practices, SAP, SQL Server, or custom organizational rules, review violations, export results to BigQuery, or automate Workload Manager through client libraries because no service-specific public CLI or MCP server is available. Don't use for general Google Compute Engine instance management, VPC configuration, or standard IAM auditing.