SuperAPI AI 工具集

Debug Cluster

测试与质量

查看项目

更新于 10-16 03:11

技能介绍

用途:本技能为 HyperShift 托管集群常见问题提供结构化调试流程,自动应用于排查托管集群删除问题、调试卡住的资源或 finalizer、控制面故障、NodePool 生命周期问题,以及审阅 operator 日志。厂商相关问题参见子技能,如 AWS 的 aws-troubleshooting.md,主技能提供与厂商无关的调试工作流。

需要理解的关键组件:资源层级为 HostedCluster(HC)、HostedControlPlane(HCP)、NodePool(NP)及 HCP 命名空间中的 CAPI 资源;操作器包括 hypershift-operator(HO)、control-plane-operator(CPO)、hosted-cluster-config-operator(HCCO);命名空间分为 HC 命名空间与 HCP 命名空间(如 clusters-<cluster-name>)。

主要使用方式:删除卡住时按顺序排查——先查 NodePool 删除(kubectl get nodepool -n <hc-namespace>、kubectl get cluster -n <hcp-namespace> -o yaml、kubectl logs -n <hcp-namespace> deployment/capi-provider、kubectl get machines -n <hcp-namespace>、kubectl describe machines -n <hcp-namespace>,并检索 HO 日志中的 nodepool 与集群名);再查 HCP 资源与 Pod 清理(kubectl get hostedcontrolplane -n <hcp-namespace> -o yaml、kubectl get pods -n <hcp-namespace> --field-selector=status.phase!=Running、kubectl logs -n <hcp-namespace> deployment/control-plane-operator --tail=100);再查命名空间删除(kubectl get namespace <hcp-namespace> -o yaml、用 api-resources 列举残留资源、用 jq 筛选带 finalizer 的资源);最后查 HostedCluster 本身(kubectl get hostedcluster -n <hc-namespace> <cluster-name> -o yaml、查看 finalizers 与 HO 日志)。

通用排查技巧包括检查 finalizer(kubectl get <resource-type> <name> -n <namespace> -o jsonpath='{.metadata.finalizers}')、查看 operator 日志(kubectl logs -n hypershift deployment/operator --tail=500 --timestamps)、获取资源事件与 conditions。

限制与注意事项:删除 finalizer 需谨慎;CRD 缺失或损坏时才应重装 HyperShift,且重装属最后手段,会造成停机;重装流程如 hypershift install render | kubectl delete -f -、hypershift install [provider-specific-flags] --enable-defaulting-webhook true 须由用户明确执行,AI 助手不得代为运行。其他参数与细节暂未提供。