gke-ai-troubleshooting-tpu-metrics-monitoring
它能做什么
这项技能帮助 AI 智能体监控并排查 Google Kubernetes Engine(GKE)上的 TPU 工作负载、节点和节点池。适合在 Google TPU 芯片上运行 AI 训练的团队。
适用场景
- ✓当 GKE 上的 TPU 训练任务变慢或停止,你想知道是否由基础设施导致时。
- ✓当你需要检查 TPU 内存使用、芯片忙碌时间,或某个 TPU 节点是否就绪时。
- ✓当你想衡量 TPU 节点池在维护或抢占后需要多久才能恢复时。
技能链接
https://github.com/google/skills/blob/main/skills/cloud/gke-ai-troubleshooting-tpu-metrics-monitoring/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“为什么我在 GKE 上的 TPU 训练任务今天运行得更慢?请帮我检查一下指标。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会使用标准的指标查询读取 Google Cloud 系统指标,并随时间比较 TPU 的健康状况,以找出问题从哪里开始。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
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.
- **Pro
常见问题
这项技能适用于 GPU 或普通的 GKE 工作负载吗?
不适用。它专用于 TPU 工作负载,并说明不要用于一般的非 TPU GKE 监控。
它会查看哪些指标?
它会查看 TPU duty cycle(占空比)、TPU 内存、节点就绪状态和节点池可用性。
开始前智能体需要什么信息?
它需要你的项目 ID、集群名称和位置;如果你有节点或节点池的名称,也可以使用。
详情
作者的原始描述
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.
repo: google/skills
热度
- GitHub 星标
- 22k
- 排名
- #10268
- 许可证
- 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 上的第一步,包括选择项目、关联计费,以及部署第一个资源。