GKE JobSet Interruption Troubleshooting
Use this skill to systematically diagnose and resolve JobSet interruptions,
restarts, and preemptions on GKE clusters hosting large-scale AI/ML workloads.
⚠️ Prerequisites & Sandbox Rules
- JobSet metrics package must be enabled in
kube-state-metrics for your
cluster.
- Cloud Logging and Cloud Monitoring enabled for the Google Cloud Project.
- Autonomous & Sandbox Execution Rule: If API queries, tools, or commands
encounter
403 Permission Denied, authentication errors, or network
isolation, do NOT enter authentication or credential troubleshooting
loops. Populate the query templates with the acquired variables
({project_id}, {cluster_name}, {workload_name}, {start_time},
{end_time}), inspect any locally staged telemetry or mock data files if
available, and complete the diagnostic workflow and resolution
recommendations autonomously.
🔍 Diagnostic Workflow
Step 0: Context Acquisition & Time Window Definition
Independently gather context using tools, workspace files, environment details,
or user prompt context:
- Project ID (
{project_id})
- Cluster Name (
{cluster_name})
- Workload Name (JobSet Name) (
{workload_name})
- Workload Namespace (
{namespace})
- Issue Time (
{issue_time})
If specific variables are not explicitly provided by the user, inspect cluster
resources or logs to determine them, or use the {variable} placeholders
provided.
Time Handling Rules
- Autonomous Time Window: If a relative time (e.g., "X minutes ago") or no
exact timestamp is provided, calculate the query window based on current
time or available log timestamps.
- Window Calculation: If a timestamp
{issue_time} is available (or
calculated as T), set {start_time} = T - 30m and {end_time} = T + 30m.
Step 1: Identify JobSet Restarts and Attempts [Low Risk]
Verify if the JobSet is experiencing restart loops and determine the frequency
of restarts.
Visual Chart / MQL Query - restarts
PromQL Metric Query - restarts
PromQL Query Specification:
kube_jobset_restarts{jobset_name="{workload_name}", cluster="{cluster_name}"}
Diagnostic Logic: A non-zero or increasing value for restarts indicates
that the JobSet is being actively restarted by the controller due to worker
failure or interruption.
Automation: Proceed to Step 2 automatically after reporting findings.
Step 2: Inspect Nodepool Interruptions [Low Risk]
Determine if the JobSet restarts were triggered by physical nodepool-level
events (such as spot preemptions, maintenance, or host terminations).
A. Metrics Query (Nodepool Interruption Counts)
Visual Chart / MQL Query - interruptions
MQL Query Specification:
fetch k8s_node_pool
| metric 'kubernetes.io/node_pool/interruption_count'
| filter cluster_name == '{cluster_name}'
| align next_older(10m)
| every 10m
| group_by [metric.interruption_type, metric.interruption_reason, metadata.system.node_pool_name], [val: sum(value)]
PromQL Query - interruptions
PromQL Query Specification:
sum by (interruption_type, interruption_reason, node_pool_name, cluster_name) (
avg_over_time(kubernetes_io:node_pool_interruption_count{cluster_name="{cluster_name}"}[10m])
)
B. Log Query (Nodepool Life Events)
LQL Log Filter Specification:
resource.type="gke_nodepool"
AND resource.labels.cluster_name="{cluster_name}"
AND timestamp >= "{start_time}"
AND timestamp <= "{end_time}"
Diagnostic Logic:
- PreemptionEvent: Spot VMs were preempted, or node was scale-down.
- MaintenanceEvent: Node pool updated or Google scheduled maintenance.
- TerminationEvent: Serious host failures. Check
interruption_reason
or logs for host issues.
- See Failure Signatures for examples
of node termination logs and preemption events.
Automation: Proceed to Step 3 automatically.
Step 3: Inspect Nodes and Underlying Host VMs [Low Risk]
Correlate node readiness failures with physical host VMs to see if a single
faulty host repeatedly fails coordinator pods.
A. Metrics Query (Node Ready Status Check)
Visual Chart / MQL Query - node status
MQL Query Specification:
fetch k8s_node
| metric 'kubernetes.io/node/status_condition'
| filter cluster_name == '{cluster_name}' && metric.condition == 'Ready' && metric.status == 'False'
| align next_older(1m)
| every 1m
| group_by [node_name, metadata.user.gke_nodepool], [val: max(value)]
PromQL Query - node status
PromQL Query Specification:
sum by (status, condition, node_pool_name) (
kubernetes_io:node_status_condition{cluster_name="{cluster_name}", condition="Ready", status="False"}
)
B. Metrics Query (Node-to-Host Metadata Topology Correlation)
MQL Query Specification:
fetch k8s_node
| metric 'kubernetes.io/node/cpu/total_cores'
| filter cluster_name == '{cluster_name}'
| align next_older(1m)
| every 1m
| group_by [node_name, metadata.user.gce_topology_host, metadata.user.gke_nodepool], [val: max(value)]
C. Log Query (Node Fault Logs)
LQL Log Filter Specification:
resource.type="k8s_node"
AND resource.labels.cluster_name="{cluster_name}"
AND (textPayload:"host error" OR textPayload:"kernel panic" OR textPayload:"hardware failure" OR textPayload:"NodeNotReady")
AND timestamp >= "{start_time}"
AND timestamp <= "{end_time}"
Diagnostic Logic: Identify if specific nodes are unhealthy
(Ready=False or Unknown) and correlate them to their GCE physical host
ID via metadata.user.gce_topology_host. Check if the same host is
repeatedly failing.
Automation: Proceed to Step 4 automatically.
Step 4: Inspect Pod and Worker / Container Failures [Low Risk]
Analyze pod status phases and retrieve coordinator worker logs to identify
application-level crashes or network deadlocks.
Required Execution Order: You MUST analyze pod status phases (Section A)
and unschedulable pod metrics (Section B) to assess overall workload health
before inspecting specific worker container logs (Section C).
A. Metrics Query (Pod Lifecycle Phases)
Visual Chart / MQL Query - pod phase
PromQL Query - pod phase
PromQL Query Specification:
sum by (phase) (
avg_over_time(kube_pod_status_phase{cluster="{cluster_name}", pod=~"{workload_name}.*"}[10m])
)
B. Metrics Query (Unschedulable Pod Count)
C. Log Query (Worker Container Logs)
LQL Log Filter Specification:
resource.type="k8s_container"
AND resource.labels.cluster_name="{cluster_name}"
AND labels."k8s-pod/jobset_sigs_k8s_io/jobset-name"="{workload_name}"
AND timestamp >= "{start_time}"
AND timestamp <= "{end_time}"
Diagnostic Logic:
- Check the pod timeline to spot pending or unschedulable pods.
- Use worker container logs to analyze worker 0 in slice 0 (coordinator)
for NCCL timeouts, collective communication issues, or MegaScale hangs.
Automation: Proceed to Resolution.
🛠️ Resolution Workflow
Resolution 1: Preemption & Autoscaling Optimizations [Low Risk]
If Step 2 showed high preemption counts on Spot VMs:
- Action: Suggest switching critical long-running training workloads to
GKE Reserved/On-Demand VMs or utilizing Compact Placement Policies
to minimize defragmentation interruptions.
- Justification: Eliminates spot-market preemptions and reduces training
restarts.
Resolution 2: Quarantine Faulty Host VMs [High Risk]
If Step 3 identified a specific host ID (gce-topology-host) that consistently
fails or triggers restarts across multiple attempts:
- Action: Recommend cordoning/draining the GKE node, deleting the
underlying GCE VM instance to trigger instance recreation, and opening a
support ticket with Google Cloud Support specifying the physical host ID.
- Justification: GKE auto-repair will recreate the VM instance on healthy
physical hardware, preventing infinite restart loops.
📋 Copypaste Checklist
1---2name: gke-ai-troubleshooting-jobset-interruption3description: Diagnoses GKE JobSet interruptions, restarts, and preemptions for AI/ML training workloads autonomously. Use when troubleshooting JobSet restart loops, spot VM preemptions, node readiness failures, host VM issues, or coordinator worker crashes. Don't use for general GKE cluster creation, basic workload deployment, or non-JobSet application issues.4---56# GKE JobSet Interruption Troubleshooting78Use this skill to systematically diagnose and resolve JobSet interruptions,9restarts, and preemptions on GKE clusters hosting large-scale AI/ML workloads.1011## ⚠️ Prerequisites & Sandbox Rules1213- JobSet metrics package must be enabled in `kube-state-metrics` for your14 cluster.15- Cloud Logging and Cloud Monitoring enabled for the Google Cloud Project.16- **Autonomous & Sandbox Execution Rule**: If API queries, tools, or commands17 encounter `403 Permission Denied`, authentication errors, or network18 isolation, **do NOT enter authentication or credential troubleshooting19 loops**. Populate the query templates with the acquired variables20 (`{project_id}`, `{cluster_name}`, `{workload_name}`, `{start_time}`,21 `{end_time}`), inspect any locally staged telemetry or mock data files if22 available, and complete the diagnostic workflow and resolution23 recommendations autonomously.2425## 🔍 Diagnostic Workflow2627### Step 0: Context Acquisition & Time Window Definition2829Independently gather context using tools, workspace files, environment details,30or user prompt context:3132- **Project ID** (`{project_id}`)33- **Cluster Name** (`{cluster_name}`)34- **Workload Name (JobSet Name)** (`{workload_name}`)35- **Workload Namespace** (`{namespace}`)36- **Issue Time** (`{issue_time}`)3738If specific variables are not explicitly provided by the user, inspect cluster39resources or logs to determine them, or use the `{variable}` placeholders40provided.4142#### Time Handling Rules43441. **Autonomous Time Window**: If a relative time (e.g., "X minutes ago") or no45 exact timestamp is provided, calculate the query window based on current46 time or available log timestamps.472. **Window Calculation**: If a timestamp `{issue_time}` is available (or48 calculated as `T`), set `{start_time}` = `T - 30m` and `{end_time}` = `T +49 30m`.5051--------------------------------------------------------------------------------5253### Step 1: Identify JobSet Restarts and Attempts [Low Risk]5455Verify if the JobSet is experiencing restart loops and determine the frequency56of restarts.5758#### Visual Chart / MQL Query - restarts5960- **MQL Query Specification**:6162 ```mql63 fetch prometheus_target64 | metric 'prometheus.googleapis.com/kube_jobset_restarts/gauge'65 | filter resource.cluster_name == '{cluster_name}' && metric.jobset_name == '{workload_name}'66 | align next_older(1m)67 | every 1m68 | group_by [metric.jobset_name], [val: max(value)]69 ```7071#### PromQL Metric Query - restarts7273- **PromQL Query Specification**:7475 ```promql76 kube_jobset_restarts{jobset_name="{workload_name}", cluster="{cluster_name}"}77 ```7879- **Diagnostic Logic**: A non-zero or increasing value for restarts indicates80 that the JobSet is being actively restarted by the controller due to worker81 failure or interruption.8283- **Automation**: Proceed to Step 2 automatically after reporting findings.8485--------------------------------------------------------------------------------8687### Step 2: Inspect Nodepool Interruptions [Low Risk]8889Determine if the JobSet restarts were triggered by physical nodepool-level90events (such as spot preemptions, maintenance, or host terminations).9192#### A. Metrics Query (Nodepool Interruption Counts)9394##### Visual Chart / MQL Query - interruptions9596- **MQL Query Specification**:9798 ```mql99 fetch k8s_node_pool100 | metric 'kubernetes.io/node_pool/interruption_count'101 | filter cluster_name == '{cluster_name}'102 | align next_older(10m)103 | every 10m104 | group_by [metric.interruption_type, metric.interruption_reason, metadata.system.node_pool_name], [val: sum(value)]105 ```106107##### PromQL Query - interruptions108109- **PromQL Query Specification**:110111 ```promql112 sum by (interruption_type, interruption_reason, node_pool_name, cluster_name) (113 avg_over_time(kubernetes_io:node_pool_interruption_count{cluster_name="{cluster_name}"}[10m])114 )115 ```116117#### B. Log Query (Nodepool Life Events)118119- **LQL Log Filter Specification**:120121 ```sql122 resource.type="gke_nodepool"123 AND resource.labels.cluster_name="{cluster_name}"124 AND timestamp >= "{start_time}"125 AND timestamp <= "{end_time}"126 ```127128- **Diagnostic Logic**:129130 - **PreemptionEvent**: Spot VMs were preempted, or node was scale-down.131 - **MaintenanceEvent**: Node pool updated or Google scheduled maintenance.132 - **TerminationEvent**: Serious host failures. Check `interruption_reason`133 or logs for host issues.134 - See [Failure Signatures](references/failure_signatures.md) for examples135 of node termination logs and preemption events.136137- **Automation**: Proceed to Step 3 automatically.138139--------------------------------------------------------------------------------140141### Step 3: Inspect Nodes and Underlying Host VMs [Low Risk]142143Correlate node readiness failures with physical host VMs to see if a single144faulty host repeatedly fails coordinator pods.145146#### A. Metrics Query (Node Ready Status Check)147148##### Visual Chart / MQL Query - node status149150- **MQL Query Specification**:151152 ```mql153 fetch k8s_node154 | metric 'kubernetes.io/node/status_condition'155 | filter cluster_name == '{cluster_name}' && metric.condition == 'Ready' && metric.status == 'False'156 | align next_older(1m)157 | every 1m158 | group_by [node_name, metadata.user.gke_nodepool], [val: max(value)]159 ```160161##### PromQL Query - node status162163- **PromQL Query Specification**:164165 ```promql166 sum by (status, condition, node_pool_name) (167 kubernetes_io:node_status_condition{cluster_name="{cluster_name}", condition="Ready", status="False"}168 )169 ```170171#### B. Metrics Query (Node-to-Host Metadata Topology Correlation)172173- **MQL Query Specification**:174175 ```mql176 fetch k8s_node177 | metric 'kubernetes.io/node/cpu/total_cores'178 | filter cluster_name == '{cluster_name}'179 | align next_older(1m)180 | every 1m181 | group_by [node_name, metadata.user.gce_topology_host, metadata.user.gke_nodepool], [val: max(value)]182 ```183184#### C. Log Query (Node Fault Logs)185186- **LQL Log Filter Specification**:187188 ```sql189 resource.type="k8s_node"190 AND resource.labels.cluster_name="{cluster_name}"191 AND (textPayload:"host error" OR textPayload:"kernel panic" OR textPayload:"hardware failure" OR textPayload:"NodeNotReady")192 AND timestamp >= "{start_time}"193 AND timestamp <= "{end_time}"194 ```195196- **Diagnostic Logic**: Identify if specific nodes are unhealthy197 (`Ready=False` or `Unknown`) and correlate them to their GCE physical host198 ID via `metadata.user.gce_topology_host`. Check if the same host is199 repeatedly failing.200201- **Automation**: Proceed to Step 4 automatically.202203--------------------------------------------------------------------------------204205### Step 4: Inspect Pod and Worker / Container Failures [Low Risk]206207Analyze pod status phases and retrieve coordinator worker logs to identify208application-level crashes or network deadlocks.209210> **Required Execution Order**: You MUST analyze pod status phases (Section A)211> and unschedulable pod metrics (Section B) to assess overall workload health212> before inspecting specific worker container logs (Section C).213214#### A. Metrics Query (Pod Lifecycle Phases)215216##### Visual Chart / MQL Query - pod phase217218- **MQL Query Specification**:219220 ```mql221 fetch k8s_pod222 | metric 'kubernetes.io/pod/status/phase'223 | filter cluster_name == '{cluster_name}' && pod_name ==~ '{workload_name}.*'224 | align next_older(10m)225 | every 10m226 | group_by [metric.phase], [val: count()]227 ```228229##### PromQL Query - pod phase230231- **PromQL Query Specification**:232233 ```promql234 sum by (phase) (235 avg_over_time(kube_pod_status_phase{cluster="{cluster_name}", pod=~"{workload_name}.*"}[10m])236 )237 ```238239#### B. Metrics Query (Unschedulable Pod Count)240241- **MQL Query Specification**:242243 ```mql244 fetch k8s_pod245 | metric 'kubernetes.io/pod/status/unschedulable'246 | filter cluster_name == '{cluster_name}' && pod_name ==~ '{workload_name}.*'247 | align next_older(10m)248 | every 10m249 | group_by [pod_name], [val: max(value)]250 ```251252#### C. Log Query (Worker Container Logs)253254- **LQL Log Filter Specification**:255256 ```sql257 resource.type="k8s_container"258 AND resource.labels.cluster_name="{cluster_name}"259 AND labels."k8s-pod/jobset_sigs_k8s_io/jobset-name"="{workload_name}"260 AND timestamp >= "{start_time}"261 AND timestamp <= "{end_time}"262 ```263264- **Diagnostic Logic**:265266 1. Check the pod timeline to spot pending or unschedulable pods.267 2. Use worker container logs to analyze worker 0 in slice 0 (coordinator)268 for NCCL timeouts, collective communication issues, or MegaScale hangs.269270- **Automation**: Proceed to Resolution.271272--------------------------------------------------------------------------------273274## 🛠️ Resolution Workflow275276### Resolution 1: Preemption & Autoscaling Optimizations [Low Risk]277278If Step 2 showed high preemption counts on Spot VMs:279280- **Action**: Suggest switching critical long-running training workloads to281 **GKE Reserved/On-Demand VMs** or utilizing **Compact Placement Policies**282 to minimize defragmentation interruptions.283- **Justification**: Eliminates spot-market preemptions and reduces training284 restarts.285286### Resolution 2: Quarantine Faulty Host VMs [High Risk]287288If Step 3 identified a specific host ID (`gce-topology-host`) that consistently289fails or triggers restarts across multiple attempts:290291- **Action**: Recommend cordoning/draining the GKE node, deleting the292 underlying GCE VM instance to trigger instance recreation, and opening a293 support ticket with Google Cloud Support specifying the physical host ID.294- **Justification**: GKE auto-repair will recreate the VM instance on healthy295 physical hardware, preventing infinite restart loops.296297--------------------------------------------------------------------------------298299## 📋 Copypaste Checklist300301- [ ] Gather context and compute `{start_time}` (`{issue_time} - 30m`) and302 `{end_time}` (`{issue_time} + 30m`) window.303- [ ] Query JobSet restart attempts.304- [ ] Check Nodepool interruptions (spot preemptions vs. hardware305 terminations).306- [ ] Query node-to-host mapping and check node logs for physical host errors.307- [ ] Inspect pod timeline status and coordinator worker container logs.308- [ ] Recommend appropriate scheduling strategy (On-demand vs Spot) or host VM309 quarantining.