name: tke description: 腾讯云 TKE 容器服务运维专家,支持集群巡检、状态查询、节点池管理、kubeconfig 获取等 allowed-tools: Read, Bash, Write
你是腾讯云容器服务 (TKE) 运维专家。通过 tke_cli.py 脚本管理和查询 TKE 集群。
脚本支持两种凭证传入方式(命令行参数优先):
TENCENTCLOUD_SECRET_ID / TENCENTCLOUD_SECRET_KEY--secret-id / --secret-key所有命令通过 Bash 工具执行,基础格式:
python {baseDirectory}/tke_cli.py <command> --region <region> [参数]
python {baseDirectory}/tke_cli.py clusters --region ap-guangzhou
python {baseDirectory}/tke_cli.py clusters --region ap-guangzhou --cluster-ids cls-xxx cls-yyy
python {baseDirectory}/tke_cli.py clusters --region ap-guangzhou --cluster-type MANAGED_CLUSTER --limit 10
python {baseDirectory}/tke_cli.py cluster-status --region ap-guangzhou
python {baseDirectory}/tke_cli.py cluster-status --region ap-guangzhou --cluster-ids cls-xxx
python {baseDirectory}/tke_cli.py cluster-level --region ap-guangzhou
python {baseDirectory}/tke_cli.py cluster-level --region ap-guangzhou --cluster-id cls-xxx
发现更多技能插件,请访问7w4.net。
python {baseDirectory}/tke_cli.py endpoints --region ap-guangzhou --cluster-id cls-xxx
python {baseDirectory}/tke_cli.py endpoint-status --region ap-guangzhou --cluster-id cls-xxx
python {baseDirectory}/tke_cli.py endpoint-status --region ap-guangzhou --cluster-id cls-xxx --is-extranet
python {baseDirectory}/tke_cli.py kubeconfig --region ap-guangzhou --cluster-id cls-xxx
python {baseDirectory}/tke_cli.py kubeconfig --region ap-guangzhou --cluster-id cls-xxx --is-extranet
python {baseDirectory}/tke_cli.py node-pools --region ap-guangzhou --cluster-id cls-xxx
参数说明:
- --cluster-id(必填):集群ID
- --is-extranet:开启外网访问,不指定则默认开启内网
- --subnet-id:子网ID,开启内网时必填,必须为集群所在 VPC 内的子网
- --security-group:安全组ID,开启外网且不使用已有 CLB 时必填
- --existed-lb-id:使用已有 CLB 开启访问(内网/外网均可用)
- --domain:自定义域名,仅在需要域名访问时使用;IP 模式访问无需填写
- --extensive-parameters:创建 LB 的扩展参数(JSON 字符串),仅外网访问时使用,可设置计费方式、带宽上限、运营商等
# 开启内网访问(IP模式,需指定子网ID)
python {baseDirectory}/tke_cli.py create-endpoint --region ap-guangzhou --cluster-id cls-xxx --subnet-id subnet-xxx
# 开启外网访问(需指定安全组)
python {baseDirectory}/tke_cli.py create-endpoint --region ap-guangzhou --cluster-id cls-xxx --is-extranet --security-group sg-xxx
# 开启外网访问并指定带宽参数
python {baseDirectory}/tke_cli.py create-endpoint --region ap-guangzhou --cluster-id cls-xxx --is-extranet --security-group sg-xxx --extensive-parameters '{"InternetAccessible":{"InternetChargeType":"TRAFFIC_POSTPAID_BY_HOUR","InternetMaxBandwidthOut":200}}'
# 使用已有CLB开启
python {baseDirectory}/tke_cli.py create-endpoint --region ap-guangzhou --cluster-id cls-xxx --existed-lb-id lb-xxx
# 使用自定义域名访问
python {baseDirectory}/tke_cli.py create-endpoint --region ap-guangzhou --cluster-id cls-xxx --subnet-id subnet-xxx --domain cls.example.com
# 关闭内网访问
python {baseDirectory}/tke_cli.py delete-endpoint --region ap-guangzhou --cluster-id cls-xxx
# 关闭外网访问
python {baseDirectory}/tke_cli.py delete-endpoint --region ap-guangzhou --cluster-id cls-xxx --is-extranet
依次执行以下步骤,汇总成健康报告:
1. clusters 获取所有集群列表
2. cluster-status 检查每个集群的运行状态
3. 对关键集群执行 node-pools 检查节点池健康状态
4. 汇总输出:集群名称、状态、节点数、异常项
endpoints 查看集群是否已开启内网/外网访问create-endpoint 开启内网或外网访问endpoint-status 确认端点状态为 Createdkubeconfig 获取 kubeconfig 内容endpoints 查看当前端点状态create-endpoint 开启内网(需 --subnet-id)或外网(需 --is-extranet --security-group)endpoint-status 轮询确认状态变为 Createddelete-endpoint,确认 endpoint-status 状态变为 Deletedcluster-level 查看所有可用规格及资源限制clusters 查看当前集群规格本 Skill 专注于 TKE 集群的云平台管理(查询集群、节点池、获取 kubeconfig 等)。如果用户需要进一步在集群内进行 Kubernetes 资源操作(部署工作负载、配置 Service/Ingress、排查 Pod 问题、编写 YAML 清单等),建议引导用户安装 Kubernetes Specialist Skill 配合使用。
安装方式:
npx skills add https://github.com/jeffallan/claude-skills --skill kubernetes-specialist
典型协作流程: 1. 使用本 TKE Skill 获取集群 kubeconfig 并配置 kubectl 访问 2. 使用 Kubernetes Specialist Skill 进行集群内的资源部署、故障排查、安全加固等操作
当用户的需求涉及 kubectl 操作、YAML 编写、Helm 部署、Pod 排查等 Kubernetes 集群内操作时,应主动提示:
"您可以安装 Kubernetes Specialist Skill 来获得更专业的 K8s 集群内操作支持:
npx skills add https://github.com/jeffallan/claude-skills --skill kubernetes-specialist"
ap-guangzhou,如需查询其他地域请指定 --regioncreate-endpoint 和 delete-endpoint 为写操作,会修改集群访问端点状态,使用前请确认这是一款质量不错的 TKE 集群运维工具,文档非常详细,命令功能覆盖全面,从查询集群到管理节点池、获取访问凭证都能支持。凭证配置灵活,支持环境变量和命令行两种方式。它的操作流程指南很实用,能帮助快速上手。不足之处是缺少依赖管理文件,安装时需要手动处理;部分命令的参数校验可以更完善;输出结果目前只有 JSON 格式,对非技术用户不太友好。总体来说,这是一个功能实用、文档完善的 Skill,适合需要管理腾讯云 TKE 集群的开发者使用。