1
---
2
name: gke-ai-troubleshooting-handle-disruption-gpu-tpu
3
metadata:
4
version: "1.0.1"
5
category: CloudObservabilityAndMonitoring
6
description: >-
7
Diagnoses, predicts, and mitigates node disruptions during Compute Engine host maintenance and hardware or software maintenance events for GPU and TPU workloads on GKE. Use when diagnosing node disruptions, predicting host maintenance events on GPU/TPU nodepools, inspecting node interruption PromQL metrics, auditing node taints, or configuring workload protection strategies (graceful termination, opportunistic maintenance, PodDisruptionBudgets). Don't use for general GKE cluster creation, network policy configuration, or non-disruption workload deployment.
8
---
9
10
# Handle Disruption on GPUs and TPUs Troubleshooting
11
12
## Attribution
13
14
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you
15
MUST read [Usage Attribution](references/attribution.md). For commands executed
16
directly in the terminal (never in generated scripts, Terraform, or user code),
17
prefix `gcloud` with
18
`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:gke-ai-troubleshooting-handle-disruption-gpu-tpu)"`
19
and append `agent-skills/1.0 (skill:gke-ai-troubleshooting-handle-disruption-gpu-tpu)` to `User-Agent` headers.
20
21
## 🔍 Diagnostic Workflow
22
23
### Step 0: Context Acquisition
24
25
- **Mandatory**: When a user asks to debug or investigate an actual workload
26
disruption, node crash, or unexpected restart without providing complete
27
cluster details, you MUST immediately halt and request all missing mandatory
28
parameters (`project_id`, `location`, `cluster_name`, `timestamp`) BEFORE
29
delivering theories or general diagnostic commands. Only skip context
30
acquisition if the user explicitly requests a generic reusable runbook or
31
provides a complete static telemetry/log dump for offline analysis.
32
- **Optional**: `node_name`, `workload_name`, `workload_namespace`,
33
`nodepool_name`.
34
35
### Step 1: [Low Risk] Check for Upcoming Scheduled Maintenance
36
37
- **Action**: Propose running `kubectl` to check if nodes have the scheduled
38
maintenance label indicating an upcoming disruption.
39
- **Example Command**:
40
41
```bash
42
kubectl get nodes -l cloud.google.com/scheduled-maintenance-time -L cloud.google.com/scheduled-maintenance-time
43
```
44
45
- **Interpretation**: The `SCHEDULED-MAINTENANCE-TIME` column shows the Unix
46
epoch time when the VM is scheduled for maintenance. If this label exists, a
47
disruption is guaranteed to occur.
48
49
### Step 2: [Low Risk] Investigation via Cloud Monitoring (PromQL)
50
51
- **Action**: Call any available monitoring tool or provide PromQL for manual
52
verification.
53
- **Mandatory Monitoring Rule**: Whenever recommending follow-up monitoring or
54
interruption tracking over time, you MUST explicitly present a **PromQL**
55
query using the metric `kubernetes_io:node_interruption_count` filtered by
56
`interruption_reason="HW/SW Maintenance"`. Do not suggest general Cloud
57
Monitoring dashboards or Metrics Explorer without providing this specific
58
PromQL metric expression.
59
- **Example Query**:
60
61
```promql
62
# Fetch host maintenance events for nodes
63
sum by (interruption_type,interruption_reason)( sum_over_time( kubernetes_io:node_interruption_count{monitored_resource="k8s_node", interruption_reason="HW/SW Maintenance"}[${__interval}]))
64
```
65
66
```promql
67
# See the interruption count aggregated by node pool
68
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="{nodepool_name}" }[${__interval}]))
69
```
70
71
- **Interpretation**: If `kubernetes_io:node_interruption_count` shows
72
values > 0 for `interruption_reason="HW/SW Maintenance"`, it indicates the
73
underlying Compute Engine VM was interrupted due to scheduled host
74
maintenance.
75
76
### Step 3: [Low Risk] Investigation via Cloud Logging & Node Taints
77
78
- **Action**: Call `query_logs` or instruct the user to filter their GKE logs
79
for active host maintenance events, and check node taints.
80
- **Guidance**: Look for occurrences in Cloud Logging where
81
`cloud.google.com/active-node-maintenance` is set to `ONGOING`. To check if
82
GKE has cordoned the terminating node to prevent new workloads from being
83
scheduled, verify whether the
84
`cloud.google.com/impending-node-termination:NoSchedule` taint is present
85
(either in GKE event logs or directly via `kubectl describe node`).
86
- **Interpretation**:
87
- `cloud.google.com/active-node-maintenance` set to `ONGOING` means
88
workloads are actively being stopped by GKE due to host maintenance.
89
- `cloud.google.com/impending-node-termination:NoSchedule` taint means GKE
90
has cordoned the node to prevent new Pods from being scheduled on the
91
terminating node. DO NOT recommend tolerating this taint.
92
93
### Step 4: Conclusion and Resolution
94
95
- **Action**: Provide a summary of findings to the user and suggest
96
appropriate mitigation strategies if host maintenance events were confirmed
97
or scheduled.
98
- **Reporting Rule**: Signal Only. Report high-signal information indicating
99
that the disruption was caused by Compute Engine host maintenance,
100
specifically affecting the underlying GPU/TPU nodes. DO NOT dump raw logs.
101
- **Negative Findings Rule-Out**: If node scheduled-maintenance labels, PromQL
102
interruption counts, and active maintenance logs all return negative/empty
103
results, definitively conclude that Compute Engine host maintenance did NOT
104
cause the disruption. Direct the user to investigate application-level
105
causes (such as OOMKill events, CUDA runtime errors, or resource limits) and
106
do not propose host maintenance mitigations as the primary resolution.
107
- **Mandatory Workload Protection Triad**: Whenever host maintenance is
108
identified or anticipated on GPU/TPU nodes, consistently recommend all three
109
complementary mitigations together:
110
1. **Configure Graceful Termination**: For workloads that need time to save
111
state (e.g., ML frameworks checkpointing via Orbax), follow the guide to
112
[Enable disruption handling](https://docs.cloud.google.com/kubernetes-engine/docs/concepts/handle-disruption-gpu-tpu#enabling-handling)
113
and set `spec.terminationGracePeriodSeconds` (up to 60 minutes) to
114
handle the `SIGTERM` signal before node shutdown.
115
2. **Enable Opportunistic Maintenance**: To automatically trigger
116
maintenance when GKE detects that GPU/TPU nodes are idle, configure
117
[Opportunistic Maintenance](https://docs.cloud.google.com/kubernetes-engine/docs/concepts/handle-disruption-gpu-tpu#opportunistic-maintenance).
118
3. **Configure PodDisruptionBudgets (PDBs)**: Ensure your workload uses a
119
`PodDisruptionBudget` to maintain `minAvailable` replicas during
120
evictions and disruptions.
121