GKE TPU Dynamic Slices Monitoring

GKE TPU Dynamic Slices Monitoring

Monitors and troubleshoots GKE TPU Dynamic Slice resources, validates slice workload manifests and safely clears stuck finalizers.

Skill files4 files

references/

scripts/

SKILL.md168 lines
1
---
2
name: gke-ai-troubleshooting-tpu-dynamic-slices-monitoring
3
description: >-
4
Monitors, troubleshoots, and manages GKE TPU Dynamic Slices custom resources. Use when checking TPU slice lifecycle states, troubleshooting slice provisioning failures, validating single-slice or multi-slice (JobSet) workload manifests, or safely patching stuck finalizers and disabling the slice controller. Don't use for generic GKE cluster node pool creation or standard non-TPU workload management (use gke-basics or gke-cluster-creation instead).
5
metadata:
6
version: "1.0.1"
7
category: Containers
8
---
9
10
# GKE TPU Dynamic Slices Monitoring & Management
11
12
Monitors the status of TPU Slice custom resources, troubleshoots provisioning
13
failures, validates workload manifests on dynamic slices, and performs cleanups.
14
15
## Attribution
16
17
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you
18
MUST read [Usage Attribution](references/attribution.md). For commands executed
19
directly in the terminal (never in generated scripts, Terraform, or user code),
20
prefix `gcloud` with
21
`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:gke-ai-troubleshooting-tpu-dynamic-slices-monitoring)"`
22
and append `agent-skills/1.0 (skill:gke-ai-troubleshooting-tpu-dynamic-slices-monitoring)` to `User-Agent` headers.
23
24
## Prerequisites
25
26
- Cloud Logging enabled for the project.
27
- `kubectl` and `gcloud` CLIs configured to access the GKE cluster.
28
29
## Diagnostic Workflow
30
31
### Step 0: Context Acquisition & Time Window Definition
32
33
Gather project, cluster, and slice context using cluster tools or the following
34
parameters:
35
36
- **Project ID**: `{project_id}` (e.g., `my-gcp-project`)
37
- **Cluster Name**: `{cluster_name}` (e.g., `tpu-cluster`)
38
- **Region/Zone**: `{location}` (e.g., `us-central1-a`)
39
- **Slice Name**: `{slice_name}` (e.g., `test-slice`)
40
- **Issue Time**: `{timestamp}` (Optional; default to the last 30 minutes
41
window `[T - 30m]` to `[T + 30m]`)
42
43
--------------------------------------------------------------------------------
44
45
### Step 1: Describe the Slice Custom Resource [Low Risk]
46
47
When asked to inspect, troubleshoot, or check a slice status, immediately execute `kubectl describe slice {slice_name}` using available cluster tools to perform the inspection. Parse the resulting `Status.Conditions` output against the condition table below to diagnose the exact state and provide concrete recommendations.
48
49
- **Command**:
50
51
```bash
52
kubectl describe slice {slice_name}
53
```
54
55
#### State & Reason Analysis
56
57
Analyze the `Status.Conditions` (especially `Type: Ready` and its `Reason` and
58
`Status`):
59
60
| Lifecycle State / Reason | Meaning | Recommended Action |
61
| :--- | :--- | :--- |
62
| **`SliceNotCreated`** | GKE Slice Controller is initializing the slice and performing resource checks. | Wait a few minutes and re-check slice status. |
63
| **`SliceCreationFailed`** | Prerequisites validation failed (e.g., selected nodes don't exist, nodes are already used by another slice, or the topology doesn't match the number of partitions). | Verify selected nodes exist, are unallocated, and topology matches partition count. |
64
| **`ACTIVATING`** | GKE is actively forming and provisioning the TPU slice. | Monitor node provisioning. |
65
| **`ACTIVE`** | The TPU slice is successfully formed and ready to host workloads. | Proceed to deploy or check workloads. |
66
| **`ACTIVE_DEGRADED`** | The slice is usable, but one or more sub-blocks are degraded. | Monitor workload logs for interconnect or device errors. Check faulty node VMs. |
67
| **`FAILED`** | GKE failed to form the TPU slice (e.g., selected nodes are not part of the same reservation block). | Ensure all selected nodes belong to the same reservation block. |
68
| **`DEACTIVATING`** | The slice is dismantling (triggered by user deletion or a critical systemic failure). | Wait for dismantling to finish, or patch finalizers if stuck. |
69
| **`INCOMPLETE`** | The terminal phase before the Slice CR is deleted from the cluster. | No action required; the resource will be removed shortly. |
70
71
#### Provisioning Failure Troubleshooting Checklist
72
73
When investigating slice creation or provisioning failures (`SliceCreationFailed` or `FAILED`), perform the following verification steps:
74
75
1. **Node Existence & Allocation Check**: Verify that the selected TPU nodes exist in the cluster and are not already allocated to another slice (`kubectl get nodes -l cloud.google.com/gke-tpu-slice`, `kubectl get slice -A`).
76
2. **Topology Alignment**: Confirm that the partition count matches the requested topology dimensions (e.g. topology `2x2` requires 4 nodes).
77
3. **Reservation Block Alignment Check**: Confirm that all selected TPU nodes belong to the same reservation and reservation block.
78
79
--------------------------------------------------------------------------------
80
81
### Step 2: Verify Workload Specification [Low Risk]
82
83
Ensure workload manifests are configured correctly to target the dynamic slice.
84
85
#### 1. Single-Slice Workload Requirements
86
87
Check that the Pod template contains the following annotations and selectors:
88
89
- **Annotations**:
90
- `cloud.google.com/gke-tpu-slice-topology: "{topology}"` (e.g.,
91
`"4x4x4"`)
92
- **NodeSelector**:
93
- `cloud.google.com/gke-tpu-topology: "{topology}"` (e.g., `"4x4x4"`)
94
- `cloud.google.com/gke-tpu-accelerator: "{accelerator_type}"` (e.g.,
95
`"tpu7x"`)
96
- `cloud.google.com/gke-tpu-slice: "{slice_name}"` (e.g., `"test-slice"`)
97
98
#### 2. Multi-Slice (JobSet) Workload Requirements
99
100
If deploying a multi-slice JobSet, verify:
101
102
- **JobSet Annotation**:
103
- `alpha.jobset.sigs.k8s.io/exclusive-topology:
104
cloud.google.com/gke-tpu-slice`
105
- **Pod Template Annotations**:
106
- `cloud.google.com/gke-tpu-slice-topology: "{topology}"`
107
- **Pod Template NodeSelector**:
108
- `cloud.google.com/gke-tpu-topology: "{topology}"`
109
- `cloud.google.com/gke-tpu-accelerator: "{accelerator_type}"`
110
- *Note: Do NOT manually specify `cloud.google.com/gke-tpu-slice` in the
111
nodeSelector; JobSet handles slice assignment automatically.*
112
113
--------------------------------------------------------------------------------
114
115
## Resolution & Management Workflow
116
117
### Resolution 1: Force Delete a Stuck Slice [High Risk]
118
119
If a slice is stuck in `DEACTIVATING` or deletion hangs indefinitely due to stuck finalizers:
120
121
1. **Identify Cause**: Explain that finalizers on the slice resource (`metadata.finalizers`) are preventing Kubernetes from completing resource deletion.
122
2. **Propose Resolution**: Propose removing finalizers from the metadata path (`/metadata/finalizers`) using a JSON patch operation:
123
124
```bash
125
kubectl patch slice {slice_name} --type json -p='[{"op": "remove", "path": "/metadata/finalizers"}]'
126
```
127
128
3. **Provide Warning**: Explicitly warn the user that removing finalizers bypasses standard controller dismantling and may leave underlying VM, network, or accelerator resources uncleaned or orphaned.
129
4. **CRITICAL SAFETY MANDATE**: The response MUST explicitly ask the user for confirmation (e.g. *"Removing finalizers on `/metadata/finalizers` via JSON patch is a high-risk operation that may leave orphaned resources. Do you confirm you want to apply this patch to slice `{slice_name}`?"*) and pause for user confirmation before applying or executing the patch.
130
131
--------------------------------------------------------------------------------
132
133
### Resolution 2: Disable and Clean Up Slice Controller [High Risk]
134
135
If dynamic slicing needs to be disabled:
136
137
1. **Check for existing Slices**:
138
139
```bash
140
kubectl get slice -A
141
```
142
143
Ensure all slices are deleted before disabling the controller.
144
145
2. **Disable Slice Controller via gcloud**:
146
147
```bash
148
gcloud container clusters update {cluster_name} \
149
--location={location} \
150
--no-enable-slice-controller
151
```
152
153
3. **Delete the Slice CRD**:
154
155
```bash
156
kubectl delete crd slices.accelerator.gke.io
157
```
158
159
4. **Clean up Node Labels**: Remove GKE TPU Slice labels from all nodes in the
160
cluster:
161
162
```bash
163
kubectl label nodes --all cloud.google.com/gke-tpu-slice- cloud.google.com/gke-tpu-slice-topology-
164
```
165
166
- **Safety Rule**: Propose the exact commands and confirm before executing
167
disabling or destructive cleanup steps.
168

© Google LLC · Apache 2.0 · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…