{"data":{"slug":"github-google-skills-skills-cloud-gke-ai-troubleshooting-tpu-dynamic-slices-monitoring-67c4c41c1b22","title":"GKE TPU Dynamic Slices Monitoring & Management","summary":"Monitors TPU slice lifecycle states, troubleshoots provisioning failures, validates single-slice or multi-slice workload manifests, and safely patches stuck finalizers or disables the slice controller for GKE TPU Dynamic Slices.","url":"https:\/\/skillshunter.net\/skills\/github-google-skills-skills-cloud-gke-ai-troubleshooting-tpu-dynamic-slices-monitoring-67c4c41c1b22","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-google-skills-skills-cloud-gke-ai-troubleshooting-tpu-dynamic-slices-monitoring-67c4c41c1b22","markdown_url":"https:\/\/skillshunter.net\/skills\/github-google-skills-skills-cloud-gke-ai-troubleshooting-tpu-dynamic-slices-monitoring-67c4c41c1b22.md","download_url":"https:\/\/skillshunter.net\/skills\/github-google-skills-skills-cloud-gke-ai-troubleshooting-tpu-dynamic-slices-monitoring-67c4c41c1b22\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Before executing any `gcloud`, REST API, or MCP command, you MUST read [Usage Attribution](references\/attribution.md). For terminal commands, prefix `gcloud` with `CLOUDSDK_METRICS_REQUEST_ATTRIBUTION=\"agent-skills\/1.0 (skill:gke-ai-troubleshooting-tpu-dynamic-slices-monitoring)\"` and append `agent-skills\/1.0 (skill:gke-ai-troubleshooting-tpu-dynamic-slices-monitoring)` to `User-Agent` headers. Removing finalizers bypasses standard controller dismantling and may leave underlying resources uncleaned or orphaned. The response MUST explicitly ask for confirmation before applying such a patch.","instructions":"---\nname: gke-ai-troubleshooting-tpu-dynamic-slices-monitoring\ndescription: >-\n  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).\nmetadata:\n  version: \"1.0.1\"\n  category: Containers\n---\n\n# GKE TPU Dynamic Slices Monitoring & Management\n\nMonitors the status of TPU Slice custom resources, troubleshoots provisioning\nfailures, validates workload manifests on dynamic slices, and performs cleanups.\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-dynamic-slices-monitoring)\"`\nand append `agent-skills\/1.0 (skill:gke-ai-troubleshooting-tpu-dynamic-slices-monitoring)` to `User-Agent` headers.\n\n## Prerequisites\n\n-   Cloud Logging enabled for the project.\n-   `kubectl` and `gcloud` CLIs configured to access the GKE cluster.\n\n## Diagnostic Workflow\n\n### Step 0: Context Acquisition & Time Window Definition\n\nGather project, cluster, and slice context using cluster tools or the following\nparameters:\n\n-   **Project ID**: `{project_id}` (e.g., `my-gcp-project`)\n-   **Cluster Name**: `{cluster_name}` (e.g., `tpu-cluster`)\n-   **Region\/Zone**: `{location}` (e.g., `us-central1-a`)\n-   **Slice Name**: `{slice_name}` (e.g., `test-slice`)\n-   **Issue Time**: `{timestamp}` (Optional; default to the last 30 minutes\n    window `[T - 30m]` to `[T + 30m]`)\n\n--------------------------------------------------------------------------------\n\n### Step 1: Describe the Slice Custom Resource [Low Risk]\n\nWhen 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.\n\n-   **Command**:\n\n    ```bash\n    kubectl describe slice {slice_name}\n    ```\n\n#### State & Reason Analysis\n\nAnalyze the `Status.Conditions` (especially `Type: Ready` and its `Reason` and\n`Status`):\n\n| Lifecycle State \/ Reason | Meaning | Recommended Action |\n| :--- | :--- | :--- |\n| **`SliceNotCreated`** | GKE Slice Controller is initializing the slice and performing resource checks. | Wait a few minutes and re-check slice status. |\n| **`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. |\n| **`ACTIVATING`** | GKE is actively forming and provisioning the TPU slice. | Monitor node provisioning. |\n| **`ACTIVE`** | The TPU slice is successfully formed and ready to host workloads. | Proceed to deploy or check workloads. |\n| **`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. |\n| **`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. |\n| **`DEACTIVATING`** | The slice is dismantling (triggered by user deletion or a critical systemic failure). | Wait for dismantling to finish, or patch finalizers if stuck. |\n| **`INCOMPLETE`** | The terminal phase before the Slice CR is deleted from the cluster. | No action required; the resource will be removed shortly. |\n\n#### Provisioning Failure Troubleshooting Checklist\n\nWhen investigating slice creation or provisioning failures (`SliceCreationFailed` or `FAILED`), perform the following verification steps:\n\n1. **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`).\n2. **Topology Alignment**: Confirm that the partition count matches the requested topology dimensions (e.g. topology `2x2` requires 4 nodes).\n3. **Reservation Block Alignment Check**: Confirm that all selected TPU nodes belong to the same reservation and reservation block.\n\n--------------------------------------------------------------------------------\n\n### Step 2: Verify Workload Specification [Low Risk]\n\nEnsure workload manifests are configured correctly to target the dynamic slice.\n\n#### 1. Single-Slice Workload Requirements\n\nCheck that the Pod template contains the following annotations and selectors:\n\n-   **Annotations**:\n    -   `cloud.google.com\/gke-tpu-slice-topology: \"{topology}\"` (e.g.,\n        `\"4x4x4\"`)\n-   **NodeSelector**:\n    -   `cloud.google.com\/gke-tpu-topology: \"{topology}\"` (e.g., `\"4x4x4\"`)\n    -   `cloud.google.com\/gke-tpu-accelerator: \"{accelerator_type}\"` (e.g.,\n        `\"tpu7x\"`)\n    -   `cloud.google.com\/gke-tpu-slice: \"{slice_name}\"` (e.g., `\"test-slice\"`)\n\n#### 2. Multi-Slice (JobSet) Workload Requirements\n\nIf deploying a multi-slice JobSet, verify:\n\n-   **JobSet Annotation**:\n    -   `alpha.jobset.sigs.k8s.io\/exclusive-topology:\n        cloud.google.com\/gke-tpu-slice`\n-   **Pod Template Annotations**:\n    -   `cloud.google.com\/gke-tpu-slice-topology: \"{topology}\"`\n-   **Pod Template NodeSelector**:\n    -   `cloud.google.com\/gke-tpu-topology: \"{topology}\"`\n    -   `cloud.google.com\/gke-tpu-accelerator: \"{accelerator_type}\"`\n    -   *Note: Do NOT manually specify `cloud.google.com\/gke-tpu-slice` in the\n        nodeSelector; JobSet handles slice assignment automatically.*\n\n--------------------------------------------------------------------------------\n\n## Resolution & Management Workflow\n\n### Resolution 1: Force Delete a Stuck Slice [High Risk]\n\nIf a slice is stuck in `DEACTIVATING` or deletion hangs indefinitely due to stuck finalizers:\n\n1. **Identify Cause**: Explain that finalizers on the slice resource (`metadata.finalizers`) are preventing Kubernetes from completing resource deletion.\n2. **Propose Resolution**: Propose removing finalizers from the metadata path (`\/metadata\/finalizers`) using a JSON patch operation:\n\n    ```bash\n    kubectl patch slice {slice_name} --type json -p='[{\"op\": \"remove\", \"path\": \"\/metadata\/finalizers\"}]'\n    ```\n\n3. **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.\n4. **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.\n\n--------------------------------------------------------------------------------\n\n### Resolution 2: Disable and Clean Up Slice Controller [High Risk]\n\nIf dynamic slicing needs to be disabled:\n\n1.  **Check for existing Slices**:\n\n    ```bash\n    kubectl get slice -A\n    ```\n\n    Ensure all slices are deleted before disabling the controller.\n\n2.  **Disable Slice Controller via gcloud**:\n\n    ```bash\n    gcloud container clusters update {cluster_name} \\\n        --location={location} \\\n        --no-enable-slice-controller\n    ```\n\n3.  **Delete the Slice CRD**:\n\n    ```bash\n    kubectl delete crd slices.accelerator.gke.io\n    ```\n\n4.  **Clean up Node Labels**: Remove GKE TPU Slice labels from all nodes in the\n    cluster:\n\n    ```bash\n    kubectl label nodes --all cloud.google.com\/gke-tpu-slice- cloud.google.com\/gke-tpu-slice-topology-\n    ```\n\n-   **Safety Rule**: Propose the exact commands and confirm before executing\n    disabling or destructive cleanup steps.\n","use_cases":["Checking TPU slice lifecycle states","Troubleshooting slice provisioning failures","Validating single-slice or multi-slice workload manifests","Cleaning up stuck finalizers or disabling the slice controller"],"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-dynamic-slices-monitoring\/SKILL.md","source_commit":"e3c591afe426ea585e4c21799e5199d6d47cd1be","license":null,"version":null,"listing_approved_at":"2026-11-17","created_at":"2026-11-16T15:01:25.000000Z","updated_at":"2026-11-17T05:10:29.000000Z","seo_title":"GKE TPU Dynamic Slices Monitoring & Management","seo_description":"Monitor, troubleshoot, and manage GKE TPU Dynamic Slices. Validate workload manifests and resolve provisioning failures for slices.","seo_keywords":["GKE TPU slice monitoring","TPU slice troubleshooting","Dynamic slices validation","GKE slice provisioning","TPU slice lifecycle management"]}}