{"data":{"slug":"github-google-skills-skills-cloud-gke-ai-troubleshooting-tpu-metrics-monitoring-2d66e08a43ce","title":"Monitor GKE TPU Metrics for Performance and Availability","summary":"This skill monitors GKE TPU workloads, nodes, and node pools using GKE system metrics and PromQL. It helps diagnose workload interruptions or performance issues caused by infrastructure problems. The deliverable is diagnostic insights into TPU memory usage, duty cycle, and node readiness.","url":"https:\/\/skillshunter.net\/skills\/github-google-skills-skills-cloud-gke-ai-troubleshooting-tpu-metrics-monitoring-2d66e08a43ce","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-google-skills-skills-cloud-gke-ai-troubleshooting-tpu-metrics-monitoring-2d66e08a43ce","markdown_url":"https:\/\/skillshunter.net\/skills\/github-google-skills-skills-cloud-gke-ai-troubleshooting-tpu-metrics-monitoring-2d66e08a43ce.md","download_url":"https:\/\/skillshunter.net\/skills\/github-google-skills-skills-cloud-gke-ai-troubleshooting-tpu-metrics-monitoring-2d66e08a43ce\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Before executing any command, you must read the Usage Attribution guidelines and prefix `gcloud` commands with `CLOUDSDK_METRICS_REQUEST_ATTRIBUTION=\"agent-skills\/1.0 (skill:gke-ai-troubleshooting-tpu-metrics-monitoring)\"`. Additionally, ensure that the TPU container exposes `containerPort: 8431`, JAX version is `0.4.14` or later, GKE version is `1.27.4-gke.900` or later, and GKE System Metrics are enabled on the cluster.","instructions":"---\nname: gke-ai-troubleshooting-tpu-metrics-monitoring\ndescription: >-\n  Monitors and troubleshoots GKE TPU workloads, nodes, and node pools using GKE\n  system metrics and PromQL. Use when monitoring TensorCore duty cycle, TPU memory,\n  node readiness, multi-host TPU node pool availability, host maintenance or\n  preemption interruptions, and calculating MTTR or MTBI metrics for GKE TPUs.\n  Don't use for general non-TPU GKE workload monitoring or non-metric TPU debugging.\nmetadata:\n  version: \"1.0.1\"\n  category: CloudObservabilityAndMonitoring\n---\n\n# GKE TPU Metrics Monitoring Guide\n\nThis 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.\n\n## Attribution\n\n**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you\nMUST read [Usage Attribution](references\/attribution.md). For commands executed\ndirectly in the terminal (never in generated scripts, Terraform, or user code),\nprefix `gcloud` with\n`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION=\"agent-skills\/1.0 (skill:gke-ai-troubleshooting-tpu-metrics-monitoring)\"`\nand append `agent-skills\/1.0 (skill:gke-ai-troubleshooting-tpu-metrics-monitoring)` to `User-Agent` headers.\n\n## Step 0: Mandatory Context\n\nIndependently gather required context (such as cluster details or node pool names) using available GKE and Cloud tools, or use the provided `{variable}` placeholders:\n\n- `{project_id}`: The GCP Project ID.\n- `{cluster_name}`: The GKE Cluster Name.\n- `{location}`: The GKE Cluster Location (region or zone).\n- `{node_name}`: (Optional) The name of the specific GKE node.\n- `{node_pool_name}`: (Optional) The name of the GKE node pool.\n\n---\n\n## Diagnostic Steps\n\n### Step 1: Verify TPU Runtime Metrics Configuration [Low Risk] [Auto]\n\nBefore 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.\n\n- **Action**: Verify that the Pod specification and cluster meet the following prerequisites:\n  - `containerPort: 8431` exposed on the TPU container (required for Prometheus metric scraping).\n  - JAX version `0.4.14` or later if using JAX (earlier versions do not export runtime metrics).\n  - GKE version is `1.27.4-gke.900` or later (required for TPU runtime metric support).\n  - GKE System Metrics are enabled on the cluster (required for Cloud Monitoring ingestion).\n\n### Step 2: Monitor TPU Runtime Metrics [Low Risk] [Auto]\n\nIf configured correctly, the following metrics are available in Cloud Monitoring (monitored resources `k8s_node` and `k8s_container`):\n\n- **Container Metrics**:\n  - `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.\n  - `kubernetes.io\/container\/accelerator\/memory_used`: Amount of accelerator memory allocated in bytes.\n  - `kubernetes.io\/container\/accelerator\/memory_total`: Total accelerator memory in bytes.\n- **Node Metrics**:\n  - `kubernetes.io\/node\/accelerator\/duty_cycle`\n  - `kubernetes.io\/node\/accelerator\/memory_used`\n  - `kubernetes.io\/node\/accelerator\/memory_total`\n\n### Step 3: Check Node Status Condition [Low Risk] [Auto]\n\nQuery the status condition of GKE nodes (GKE version `1.32.1-gke.1357001` or later).\n\n- **PromQL Query (Check if a specific node is Ready)**:\n  ```promql\n  kubernetes_io:node_status_condition{monitored_resource=\"k8s_node\", cluster_name=\"{cluster_name}\", node_name=\"{node_name}\", condition=\"Ready\", status=\"True\"}\n  ```\n- **PromQL Query (List nodes with non-Ready conditions that are True)**:\n  ```promql\n  kubernetes_io:node_status_condition{monitored_resource=\"k8s_node\", cluster_name=\"{cluster_name}\", condition!=\"Ready\", status=\"True\"}\n  ```\n- **PromQL Query (List nodes that are NOT Ready)**:\n  ```promql\n  kubernetes_io:node_status_condition{monitored_resource=\"k8s_node\", cluster_name=\"{cluster_name}\", condition=\"Ready\", status=\"False\"}\n  ```\n- **PromQL Query (Fleet-wide node status)**:\n  ```promql\n  avg by (condition,status)(avg_over_time(kubernetes_io:node_status_condition{monitored_resource=\"k8s_node\"}[5m]))\n  ```\n\n### Step 4: Check Node Pool Status [Low Risk] [Auto]\n\nQuery the status of multi-host TPU node pools.\n\n- **PromQL Query (Verify if a specific node pool is Running)**:\n  ```promql\n  kubernetes_io:node_pool_status{monitored_resource=\"k8s_node_pool\", cluster_name=\"{cluster_name}\", node_pool_name=\"{node_pool_name}\", status=\"Running\"}\n  ```\n- **PromQL Query (Monitor node pools grouped by status)**:\n  ```promql\n  count by (status)(count_over_time(kubernetes_io:node_pool_status{monitored_resource=\"k8s_node_pool\"}[5m]))\n  ```\n  _Possible statuses_: `Provisioning`, `Running`, `Error`, `Reconciling`, `Stopping`.\n\n### Step 5: Check Node Pool Availability [Low Risk] [Auto]\n\nQuery if all nodes in a multi-host TPU node pool are available.\n\n- **PromQL Query (Check availability over time)**:\n  ```promql\n  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]))\n  ```\n  _Value_: `1` (True, all nodes available) or `0` (False, some nodes unavailable).\n\n### Step 6: Analyze Node Interruptions [Low Risk] [Auto]\n\nQuery the count of interruptions for GKE nodes.\n\n- **PromQL Query (Breakdown of interruptions and causes)**:\n  ```promql\n  sum by (interruption_type,interruption_reason)(sum_over_time(kubernetes_io:node_interruption_count{monitored_resource=\"k8s_node\"}[5m]))\n  ```\n  _Interruption Types_: `TerminationEvent`, `MaintenanceEvent`, `PreemptionEvent`.\n  _Interruption Reasons_: `HostError`, `Eviction`, `AutoRepair`.\n- **PromQL Query (Filter for Host Maintenance events)**:\n  ```promql\n  sum by (interruption_type,interruption_reason)(sum_over_time(kubernetes_io:node_interruption_count{monitored_resource=\"k8s_node\", interruption_reason=\"HW\/SW Maintenance\"}[5m]))\n  ```\n- **PromQL Query (Interruption count aggregated by node pool)**:\n  ```promql\n  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]))\n  ```\n\n### Step 7: Calculate Recovery and Interruption Metrics [Low Risk] [Auto]\n\nCalculate Mean Time to Recovery (MTTR) and Mean Time Between Interruptions (MTBI) over the last 7 days.\n\n- **PromQL Query (MTTR - Mean Time to Recovery)**:\n  ```promql\n  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]))\n  ```\n- **PromQL Query (MTBI - Mean Time Between Interruptions)**:\n  ```promql\n  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]))\n  ```\n\n### Step 8: Monitor TPU Host Metrics [Low Risk] [Auto]\n\nFor GKE version `1.28.1-gke.1066000` or later, monitor TPU host performance.\n\n- **Container Metrics**:\n  - `kubernetes.io\/container\/accelerator\/tensorcore_utilization`: Current percentage of the TensorCore that is utilized.\n  - `kubernetes.io\/container\/accelerator\/memory_bandwidth_utilization`: Current percentage of the accelerator memory bandwidth that is being used.\n- **Node Metrics**:\n  - `kubernetes.io\/node\/accelerator\/tensorcore_utilization`\n  - `kubernetes.io\/node\/accelerator\/memory_bandwidth_utilization`\n\n","use_cases":["Identify if workload interruptions are caused by TPU memory or duty cycle issues.","Detect node readiness issues or preemption interruptions in GKE TPU clusters.","Calculate MTTR or MTBI metrics for GKE TPUs to assess system reliability."],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/google\/skills\/blob\/e3c591afe426ea585e4c21799e5199d6d47cd1be\/skills\/cloud\/gke-ai-troubleshooting-tpu-metrics-monitoring\/SKILL.md","source_commit":"e3c591afe426ea585e4c21799e5199d6d47cd1be","license":null,"version":null,"listing_approved_at":"2026-11-17","created_at":"2026-11-16T15:04:49.000000Z","updated_at":"2026-11-17T05:10:29.000000Z","seo_title":"Monitor GKE TPU Metrics for Performance and Availability","seo_description":"Monitor GKE TPU workloads, nodes, and node pools using GKE system metrics and PromQL. Diagnose workload interruptions or performance issues caused by infrastructure.","seo_keywords":["GKE TPU metrics monitoring","TPU node readiness check","GKE TPU duty cycle analysis","TPU memory usage monitoring","GKE node pool status check"]}}