gke-ai-troubleshooting-tpu-dynamic-slices-monitoring
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGKE TPU Dynamic Slices Monitoring & Management
GKE TPU动态切片监控与管理
Monitors the status of TPU Slice custom resources, troubleshoots provisioning
failures, validates workload manifests on dynamic slices, and performs cleanups.
监控TPU切片自定义资源的状态,排查配置失败问题,验证动态切片上的工作负载清单,并执行清理操作。
Prerequisites
前提条件
- Cloud Logging enabled for the project.
- and
kubectlCLIs configured to access the GKE cluster.gcloud
- 项目已启用Cloud Logging。
- 和
kubectlCLI已配置为可访问GKE集群。gcloud
Diagnostic Workflow
诊断流程
Step 0: Context Acquisition & Time Window Definition
步骤0:获取上下文与定义时间窗口
Gather project, cluster, and slice context using cluster tools or the following
parameters:
- Project ID: (e.g.,
{project_id})my-gcp-project - Cluster Name: (e.g.,
{cluster_name})tpu-cluster - Region/Zone: (e.g.,
{location})us-central1-a - Slice Name: (e.g.,
{slice_name})test-slice - Issue Time: (Optional; default to the last 30 minutes window
{timestamp}to[T - 30m])[T + 30m]
使用集群工具或以下参数收集项目、集群和切片上下文:
- 项目ID:(例如:
{project_id})my-gcp-project - 集群名称:(例如:
{cluster_name})tpu-cluster - 区域/可用区:(例如:
{location})us-central1-a - 切片名称:(例如:
{slice_name})test-slice - 问题时间:(可选;默认使用最近30分钟的时间窗口
{timestamp}至[T - 30m])[T + 30m]
Step 1: Describe the Slice Custom Resource [Low Risk]
步骤1:描述切片自定义资源 [低风险]
When asked to inspect, troubleshoot, or check a slice status, immediately execute using available cluster tools to perform the inspection. Parse the resulting output against the condition table below to diagnose the exact state and provide concrete recommendations.
kubectl describe slice {slice_name}Status.Conditions-
Command:bash
kubectl describe slice {slice_name}
当需要检查、排查或查看切片状态时,立即使用集群工具执行进行检查。将得到的输出与下表对比,诊断具体状态并提供明确建议。
kubectl describe slice {slice_name}Status.Conditions-
命令:bash
kubectl describe slice {slice_name}
State & Reason Analysis
状态与原因分析
Analyze the (especially and its and
):
Status.ConditionsType: ReadyReasonStatus| Lifecycle State / Reason | Meaning | Recommended Action |
|---|---|---|
| GKE Slice Controller is initializing the slice and performing resource checks. | Wait a few minutes and re-check slice status. |
| 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. |
| GKE is actively forming and provisioning the TPU slice. | Monitor node provisioning. |
| The TPU slice is successfully formed and ready to host workloads. | Proceed to deploy or check workloads. |
| The slice is usable, but one or more sub-blocks are degraded. | Monitor workload logs for interconnect or device errors. Check faulty node VMs. |
| 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. |
| The slice is dismantling (triggered by user deletion or a critical systemic failure). | Wait for dismantling to finish, or patch finalizers if stuck. |
| The terminal phase before the Slice CR is deleted from the cluster. | No action required; the resource will be removed shortly. |
分析(尤其是及其和):
Status.ConditionsType: ReadyReasonStatus| 生命周期状态/原因 | 含义 | 建议操作 |
|---|---|---|
| GKE切片控制器正在初始化切片并执行资源检查。 | 等待几分钟后重新检查切片状态。 |
| 前提条件验证失败(例如:所选节点不存在、节点已被其他切片占用,或拓扑结构与分区数量不匹配)。 | 验证所选节点是否存在、未被分配,且拓扑结构与分区数量匹配。 |
| GKE正在主动构建并配置TPU切片。 | 监控节点配置进度。 |
| TPU切片已成功构建,可承载工作负载。 | 继续部署或检查工作负载。 |
| 切片可正常使用,但一个或多个子块已降级。 | 监控工作负载日志,查看互连或设备错误。检查故障节点VM。 |
| GKE构建TPU切片失败(例如:所选节点不属于同一预留块)。 | 确保所有所选节点属于同一预留和预留块。 |
| 切片正在拆解(由用户删除操作或严重系统故障触发)。 | 等待拆解完成,若卡住则修补终结器。 |
| 切片CR从集群中删除前的终端阶段。 | 无需操作;资源将很快被移除。 |
Provisioning Failure Troubleshooting Checklist
配置失败排查清单
When investigating slice creation or provisioning failures ( or ), perform the following verification steps:
SliceCreationFailedFAILED- 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 - Topology Alignment: Confirm that the partition count matches the requested topology dimensions (e.g. topology requires 4 nodes).
2x2 - Reservation Block Alignment Check: Confirm that all selected TPU nodes belong to the same reservation and reservation block.
当排查切片创建或配置失败问题(或)时,执行以下验证步骤:
SliceCreationFailedFAILED- 节点存在性与分配检查:验证所选TPU节点是否存在于集群中,且未被分配给其他切片(执行、
kubectl get nodes -l cloud.google.com/gke-tpu-slice)。kubectl get slice -A - 拓扑结构对齐:确认分区数量与请求的拓扑维度匹配(例如:拓扑需要4个节点)。
2x2 - 预留块对齐检查:确认所有所选TPU节点属于同一预留和预留块。
Step 2: Verify Workload Specification [Low Risk]
步骤2:验证工作负载规格 [低风险]
Ensure workload manifests are configured correctly to target the dynamic slice.
确保工作负载清单已正确配置为指向动态切片。
1. Single-Slice Workload Requirements
1. 单切片工作负载要求
Check that the Pod template contains the following annotations and selectors:
- Annotations:
- (e.g.,
cloud.google.com/gke-tpu-slice-topology: "{topology}")"4x4x4"
- NodeSelector:
- (e.g.,
cloud.google.com/gke-tpu-topology: "{topology}")"4x4x4" - (e.g.,
cloud.google.com/gke-tpu-accelerator: "{accelerator_type}")"tpu7x" - (e.g.,
cloud.google.com/gke-tpu-slice: "{slice_name}")"test-slice"
检查Pod模板是否包含以下注解和选择器:
- 注解:
- (例如:
cloud.google.com/gke-tpu-slice-topology: "{topology}")"4x4x4"
- 节点选择器:
- (例如:
cloud.google.com/gke-tpu-topology: "{topology}")"4x4x4" - (例如:
cloud.google.com/gke-tpu-accelerator: "{accelerator_type}")"tpu7x" - (例如:
cloud.google.com/gke-tpu-slice: "{slice_name}")"test-slice"
2. Multi-Slice (JobSet) Workload Requirements
2. 多切片(JobSet)工作负载要求
If deploying a multi-slice JobSet, verify:
- JobSet Annotation:
alpha.jobset.sigs.k8s.io/exclusive-topology: cloud.google.com/gke-tpu-slice
- Pod Template Annotations:
cloud.google.com/gke-tpu-slice-topology: "{topology}"
- Pod Template NodeSelector:
cloud.google.com/gke-tpu-topology: "{topology}"cloud.google.com/gke-tpu-accelerator: "{accelerator_type}"- Note: Do NOT manually specify in the nodeSelector; JobSet handles slice assignment automatically.
cloud.google.com/gke-tpu-slice
若部署多切片JobSet,验证:
- JobSet注解:
alpha.jobset.sigs.k8s.io/exclusive-topology: cloud.google.com/gke-tpu-slice
- Pod模板注解:
cloud.google.com/gke-tpu-slice-topology: "{topology}"
- Pod模板节点选择器:
cloud.google.com/gke-tpu-topology: "{topology}"cloud.google.com/gke-tpu-accelerator: "{accelerator_type}"- 注意:请勿在节点选择器中手动指定;JobSet会自动处理切片分配。
cloud.google.com/gke-tpu-slice
Resolution & Management Workflow
解决与管理流程
Resolution 1: Force Delete a Stuck Slice [High Risk]
解决方案1:强制删除卡住的切片 [高风险]
If a slice is stuck in or deletion hangs indefinitely due to stuck finalizers:
DEACTIVATING-
Identify Cause: Explain that finalizers on the slice resource () are preventing Kubernetes from completing resource deletion.
metadata.finalizers -
Propose Resolution: Propose removing finalizers from the metadata path () using a JSON patch operation:
/metadata/finalizersbashkubectl patch slice {slice_name} --type json -p='[{"op": "remove", "path": "/metadata/finalizers"}]' -
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.
-
CRITICAL SAFETY MANDATE: The response MUST explicitly ask the user for confirmation (e.g. "Removing finalizers onvia JSON patch is a high-risk operation that may leave orphaned resources. Do you confirm you want to apply this patch to slice
/metadata/finalizers?") and pause for user confirmation before applying or executing the patch.{slice_name}
如果切片卡在状态,或因终结器卡住导致删除操作无限期挂起:
DEACTIVATING-
确定原因:说明切片资源上的终结器()阻止Kubernetes完成资源删除。
metadata.finalizers -
提出解决方案:建议使用JSON补丁操作从元数据路径()移除终结器:
/metadata/finalizersbashkubectl patch slice {slice_name} --type json -p='[{"op": "remove", "path": "/metadata/finalizers"}]' -
提供警告:明确警告用户,移除终结器会绕过标准控制器拆解流程,可能导致底层VM、网络或加速器资源未被清理或成为孤儿资源。
-
关键安全要求:回复中必须明确请求用户确认(例如:"通过JSON补丁移除上的终结器是高风险操作,可能产生孤儿资源。您确认要对切片
/metadata/finalizers应用此补丁吗?"),并在应用或执行补丁前等待用户确认。{slice_name}
Resolution 2: Disable and Clean Up Slice Controller [High Risk]
解决方案2:禁用并清理切片控制器 [高风险]
If dynamic slicing needs to be disabled:
-
Check for existing Slices:bash
kubectl get slice -AEnsure all slices are deleted before disabling the controller. -
Disable Slice Controller via gcloud:bash
gcloud container clusters update {cluster_name} \ --location={location} \ --no-enable-slice-controller -
Delete the Slice CRD:bash
kubectl delete crd slices.accelerator.gke.io -
Clean up Node Labels: Remove GKE TPU Slice labels from all nodes in the cluster:bash
kubectl label nodes --all cloud.google.com/gke-tpu-slice- cloud.google.com/gke-tpu-slice-topology-
- Safety Rule: Propose the exact commands and confirm before executing disabling or destructive cleanup steps.
如果需要禁用动态切片功能:
-
检查现有切片:bash
kubectl get slice -A确保所有切片已删除后再禁用控制器。 -
通过gcloud禁用切片控制器:bash
gcloud container clusters update {cluster_name} \ --location={location} \ --no-enable-slice-controller -
删除Slice CRD:bash
kubectl delete crd slices.accelerator.gke.io -
清理节点标签:从集群所有节点中移除GKE TPU切片标签:bash
kubectl label nodes --all cloud.google.com/gke-tpu-slice- cloud.google.com/gke-tpu-slice-topology-
- 安全规则:提供准确命令,并在执行禁用或破坏性清理步骤前获取用户确认。