nodegroup
它能做什么
这个技能帮助 AI 智能体在 edgewize 环境中处理 NodeGroup 资源。适合将节点分组并分配到命名空间或工作区的运维人员。
适用场景
- ✓当你想创建一个 NodeGroup 并向其中添加节点时。
- ✓当你需要将命名空间或工作区绑定到 NodeGroup,或移除绑定时。
- ✓当 NodeGroup 未完成同步,并且你需要找出原因时。
技能链接
https://github.com/kubesphere/kubesphere/blob/master/skills/nodegroup/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我创建一个名为 edge-east 的 NodeGroup,添加节点 edge-1 和 edge-2,并将其绑定到 east 工作区。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会使用随附的脚本登录 KubeSphere API,并执行 NodeGroup 操作。只有在检查结果或作为备用方案时,它才会使用 kubectl。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
NodeGroup Operations
Purpose
Use this skill to perform real nodegroup-related operations in the edgewize-io/nodegroup environment.
This skill should help with:
- listing and inspecting
NodeGroup - creating, updating, patching, and deleting
NodeGroup - binding and unbinding nodes
- binding and unbinding namespaces
- binding and unbinding workspaces
- troubleshooting failed or incomplete nodegroup sync
- checking deployment config under
config/nodegroup
Prefer using the bundled script scripts/nodegroup_api.py for authenticated KAPI operations. Use kubectl only as a verification or fallback tool when the API path is unavailable.
Prerequisites
Use the bundled script:
scripts/nodegroup_api.py
Authentication model:
- logs in against
/oauth/token - stores token in
~/.kubesphere_token - uses
KUBESPHERE_HOST,KUBESPHERE_USERNAME,KUBESPHERE_PASSWORD, andKUBESPHERE_TOKEN
Setup:
cd scripts
pip install requests
export KUBESPHERE_HOST="http://<kubesphere-host>"
python nodegroup_api.py login --username admin --password <password>
Token helpers:
python nodegroup_api.py clear-cache
python nodegroup_api.py request GET /kapis/infra.kubesphere.io/v1alpha1/nodegroups
Source of Truth
When you need to confirm how an operation works, read these files first from the nodegroup source repository root:
pkg/kapis/infra/v1alpha1/register.gopkg/kapis/infra/v1alpha1/handler.gopkg/kapis/infra/v1alpha1/workspace_handler.gopkg/controller/nodegroup/nodegroup_controller.gopkg/constants/constants.go
Do not invent unsupported operations. Base the workflow on the source repository.
Main Resources
NodeGroup
Cluster-scoped resource.
Important fields:
spec.aliasspec.descriptionspec.managerstatus.state
Safe Operating Rules
- Read-only requests: prefer
python nodegroup_api.py ...query commands. - Write requests: perform only the exact requested change.
- Do not delete resources unless the user explicitly asks for deletion.
- For destructive or potentially disruptive actions such as node unbind or delete, confirm impact in your response if the request is ambiguous.
- When changing bindings, verify the current state first, then apply the change, then verify the result.
Preferred Operation Flow
For any write operation, follow this order:
- Inspect the current resource.
- Apply the minimal required change.
- Verify the resulting resource and any affected node, namespace, or workspace.
- If sync looks wrong, inspect labels, annotations, and controller behavior.
Core Commands
1. Query NodeGroups
python nodegroup_api.py nodegroup list
python nodegroup_api.py nodegroup get <name>
2. Create a NodeGroup
python nodegroup_api.py nodegroup create \
--name <nodegroup-name> \
--alias "<alias>" \
--description "<description>" \
--manager "<manager>"
python nodegroup_api.py nodegroup get <nodegroup-name>
3. Update or Patch a NodeGroup
Prefer patching for small changes.
python nodegroup_api.py nodegroup patch <name> \
--alias "<new-alias>" \
--description "<new-description>" \
--manager "<manager>"
python nodegroup_api.py nodegroup get <name>
For unsupported fields or ad hoc testing, use raw request mode.
For PATCH, send a JSON Patch array:
python nodegroup_api.py request PATCH /kapis/infra.kubesphere.io/v1alpha1/nodegroups/<name> '[{"op":"add","path":"/spec/alias","value":"<new-alias>"}]'
4. Delete a NodeGroup
Only do this when explicitly requested.
python nodegroup_api.py nodegroup delete <name>
If delete hangs, inspect finalizers:
python nodegroup_api.py nodegroup get <name>
Relevant finalizer:
finalizers.nodegroups.kubesphere.io
5. Bind or Unbind a Node
Node binding is implemented through nodegroup APIs and reflected with label:
apps.edgewize.io/nodegroup=<nodegroup-name>
Read current state:
kubectl get node <node-name> --show-labels
kubectl get nodes -l apps.edgewize.io/nodegroup=<nodegroup-name>
Operate through the bundled script:
python nodegroup_api.py bind node --nodegroup <nodegroup-name> --node <node-name>
python nodegroup_api.py unbind node --nodegroup <nodegroup-name> --node <node-name>
# Verify
kubectl get nodes -l apps.edgewize.io/nodegroup=<nodegroup-name>
kubectl get node <node-name> -o yaml
6. Bind or Unbind a Namespace
Read current s
常见问题
智能体如何登录?
它通过 API 登录,使用你设置为环境变量的主机和凭据,并将令牌存储在本地。
它能删除 NodeGroup 吗?
可以。该技能涵盖删除 NodeGroup,以及解除节点、命名空间和工作区的绑定。
如果 API 不可用怎么办?
智能体可以改用 kubectl 检查状态。
详情
作者的原始描述
NodeGroup operation Skill for the edgewize nodegroup project. Use this whenever the user wants to query, create, update, delete, bind, unbind, or troubleshoot NodeGroup resources, including node binding, namespace binding, workspace binding, and deployment/config inspection for nodegroup.
repo: kubesphere/kubesphere
热度
- GitHub 星标
- 17k
- 排名
- #10782
- 许可证
- —
- 更新时间
- 2026/7/14
评论
- …
同一仓库的更多技能
frontend-forge-fe-operations
17k帮你的智能体在 KubeSphere 中管理 FrontendExtension 资源,包括构建、发布和调试。
frontend-forge-fi-operations
17k帮你的智能体在 KubeSphere 中创建、更新、启用、禁用和检查 FrontendIntegration 资源及 frontend-forge 扩展。
frontend-integration-yaml
17k帮你的智能体为一个菜单及其一个或多个页面,创建可直接提交的 FrontendIntegration YAML。
kubeeye
17k帮你的智能体安装 KubeEye,设置集群巡检规则和计划,并阅读巡检报告。