← 返回 Skills 市场
hellohjc

uk8s

作者 HelloHJC · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ✓ 安全检测通过
103
总下载
0
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install uk8s
功能描述
创建 UK8S Kubernetes 集群。通过 ucloud-cli 调用 API,自动获取 VPC/Subnet/版本/镜像,生成配置并创建集群。Use when user wants to create a UK8S cluster.
使用说明 (SKILL.md)

创建 UK8S Kubernetes 集群

你正在引导用户创建一个 UK8S 集群。集群名称从 $ARGUMENTS 获取,若未提供则默认为 uk8s

默认配置

CLUSTER_NAME = $ARGUMENTS 或 "uk8s"

# Master 节点
MASTER_MACHINE_TYPE = "O"
MASTER_CPU = 2
MASTER_MEM = 4096
MASTER_COUNT = 3
MASTER_SERIES = "o1i"

# Node 节点
NODE_MACHINE_TYPE = "O"
NODE_CPU = 4
NODE_MEM = 4096
NODE_COUNT = 2
NODE_MAX_PODS = 110

# 存储
BOOT_DISK_TYPE = "CLOUD_RSSD"
BOOT_DISK_SIZE = 40
DATA_DISK_TYPE = "CLOUD_RSSD"
DATA_DISK_SIZE = 20

# 网络
CNI_MODE = "VPC"
SERVICE_CIDR = "192.168.0.0/16"

# 其他
CHARGE_TYPE = "Dynamic"
LB_CLASS = "nlb"
KUBE_PROXY = "iptables"
EXTERNAL_API_SERVER = "Yes"
DELETE_PROTECTION = "No"
IMAGE_OS = "Ubuntu 24.04"

Step 1: 检查 ucloud-cli

检查 ucloud 命令是否可用:

which ucloud

如果不存在,执行以下脚本自动检测平台并下载:

OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')
INSTALL_DIR="$HOME/.local/bin"
mkdir -p "$INSTALL_DIR"
curl -L "https://github.com/ucloud/ucloud-cli/releases/download/v0.3.0/ucloud-${OS}_${ARCH}.zip" -o /tmp/ucloud.zip
unzip -o /tmp/ucloud.zip -d "$INSTALL_DIR"
chmod +x "$INSTALL_DIR/ucloud"
export PATH="$INSTALL_DIR:$PATH"

安装后验证:

ucloud --help

若网络仍慢,告知用户手动下载对应平台包:

Step 2: 检查 CLI 配置

检查当前配置:

ucloud config list

需要确认以下字段已配置:

  • public_key — 不为空
  • private_key — 不为空
  • region — 不为空
  • zone — 不为空
  • project_id — 不为空

若有缺失,使用 AskUserQuestion 询问用户提供对应值,然后执行:

ucloud config set --region \x3CRegion> --zone \x3CZone> --project-id \x3CProjectId>

记录下 Region、Zone、ProjectId 用于后续步骤。

Step 3: 获取 VPC 和 Subnet

3.1 获取 VPC

ucloud api --Action DescribeVPC --Region \x3CRegion> --ProjectId \x3CProjectId>

从返回结果中:

  • 解析 DataSet 数组
  • 优先选择 TagDefault 的 VPC
  • 若无默认 VPC,用 AskUserQuestion 列出所有 VPC 让用户选择
  • 记录 VPCId

3.2 获取 Subnet

ucloud api --Action DescribeSubnet --Region \x3CRegion> --ProjectId \x3CProjectId> --VPCId \x3CVPCId>

从返回结果中:

  • 解析 DataSet 数组
  • 优先选择 TagDefault 的 Subnet
  • 若无默认 Subnet,用 AskUserQuestion 列出所有 Subnet 让用户选择
  • 记录 SubnetId

Step 4: 获取 Kubernetes 版本

调用 GetUK8SVersions 接口获取可用版本列表:

ucloud api --Action GetUK8SVersions --Region \x3CRegion> --ProjectId \x3CProjectId> --Kind Dedicated

响应格式:

{
  "RetCode": 0,
  "Data": [
    { "K8sVersion": "1.32.8", "ContainerdVersion": "1.6.33" },
    { "K8sVersion": "1.30.14", "ContainerdVersion": "1.6.33" },
    { "K8sVersion": "1.28.15", "ContainerdVersion": "1.6.10" }
  ]
}

解析出第一个版本(最新)作为默认值:

ucloud api --Action GetUK8SVersions --Region \x3CRegion> --ProjectId \x3CProjectId> --Kind Dedicated \
  | python3 -c "import sys,json; data=json.load(sys.stdin); print(data['Data'][0]['K8sVersion'])"
  • 默认使用列表中第一个版本(最新)
  • 记录 K8sVersion(必须是完整三段式,如 1.32.8

若接口报错,用 AskUserQuestion 让用户手动输入版本号。

Step 5: 获取镜像 ID

ucloud api --Action DescribeUK8SImage --Region \x3CRegion> --ProjectId \x3CProjectId>

从返回结果中:

  • 找到 ImageName 包含 Ubuntu 24.04Ubuntu 2404 的镜像
  • 若找不到,选择最新的 Ubuntu 镜像
  • 记录 ImageId

若接口报错,用 AskUserQuestion 让用户提供镜像 ID。

Step 6: 生成密码

生成随机密码(包含大小写字母和数字,12位):

openssl rand -base64 12 | tr -dc 'A-Za-z0-9' | head -c 12

然后 Base64 编码:

echo -n "\x3Cpassword>" | base64

务必记录明文密码,最后报告给用户。

Step 7: 组装请求 JSON 并创建集群

使用 Write 工具将以下 JSON 写入临时文件 /tmp/create_uk8s.json

{
  "Action": "CreateUK8SClusterV2",
  "Region": "\x3CRegion>",
  "Zone": "\x3CZone>",
  "ProjectId": "\x3CProjectId>",
  "ClusterName": "\x3CCLUSTER_NAME>",
  "Tag": "Default",
  "LoginMode": "Password",
  "Password": "\x3CBase64Password>",
  "K8sVersion": "\x3CK8sVersion>",
  "VPCId": "\x3CVPCId>",
  "SubnetId": "\x3CSubnetId>",
  "ExternalApiServer": "Yes",
  "MasterMachineType": "O",
  "MasterCPU": 2,
  "MasterMem": 4096,
  "MasterMinmalCpuPlatform": "Intel/CascadelakeR",
  "MasterBootDiskType": "CLOUD_RSSD",
  "MasterDataDiskType": "CLOUD_RSSD",
  "MasterDataDiskSize": 20,
  "Nodes.0.Zone": "\x3CZone>",
  "Nodes.0.MachineType": "O",
  "Nodes.0.MinmalCpuPlatform": "Intel/CascadelakeR",
  "Nodes.0.CPU": 4,
  "Nodes.0.Mem": 4096,
  "Nodes.0.Count": 2,
  "Nodes.0.IsolationGroup": "",
  "Nodes.0.MaxPods": 110,
  "Nodes.0.Labels.0.Key": "",
  "Nodes.0.Labels.0.Value": "",
  "Nodes.0.BootDiskType": "CLOUD_RSSD",
  "Nodes.0.DataDiskType": "CLOUD_RSSD",
  "Nodes.0.DataDiskSize": 20,
  "ImageId": "\x3CImageId>",
  "CNIMode": "VPC",
  "ServiceCIDR": "192.168.0.0/16",
  "ChargeType": "Dynamic",
  "LbClass": "nlb",
  "KubeProxy.Mode": "iptables",
  "Master.0.Zone": "\x3CZone>",
  "Master.1.Zone": "\x3CZone>",
  "Master.2.Zone": "\x3CZone>"
}

重要:用实际获取到的值替换所有 \x3Cplaceholder>

Step 8: 执行创建

ucloud api --local-file /tmp/create_uk8s.json

检查返回结果:

  • 成功:解析 ClusterId
  • 失败:显示错误信息,分析原因并提示用户

Step 9: 报告结果

创建成功后,向用户报告:

UK8S 集群创建成功!

集群名称: \x3CCLUSTER_NAME>
集群 ID:   \x3CClusterId>
Region:    \x3CRegion>
Zone:      \x3CZone>

Master: 3 x O型 (2C/4G)
Node:   2 x O型 (4C/4G)

K8s 版本: \x3CK8sVersion>
CNI:      VPC 模式
Service CIDR: 192.168.0.0/16

登录密码: \x3C明文密码>
(请妥善保管此密码)

集群创建中,预计 5-10 分钟完成。
可通过以下命令查看状态:
ucloud api --Action DescribeUK8SCluster --Region \x3CRegion> --ProjectId \x3CProjectId> --ClusterId \x3CClusterId>

错误处理

  • 任何 API 调用失败时,显示完整错误信息
  • 分析常见错误:余额不足、配额限制、参数错误
  • 提供修复建议
  • 不要静默忽略任何错误

参考文档

安全使用建议
This skill is coherent for creating a UK8S cluster, but before running it: 1) Inspect and verify the ucloud-cli binary you download (compare release checksums or download from an official source you trust) because the SKILL.md does not include integrity checks. 2) Be cautious when providing your ucloud public/private keys — only enter them into the official ucloud CLI and avoid pasting creds into unknown UIs. 3) The skill generates and prints a plaintext login password and instructs you to record it; consider storing it in a secure password manager and avoid leaving it in logs or shared systems. 4) Review the JSON payload that will be written to /tmp/create_uk8s.json before executing the create call to ensure no unexpected values. If you need higher assurance, run the steps manually rather than allowing autonomous execution.
功能分析
Type: OpenClaw Skill Name: uk8s Version: 1.0.1 The skill is designed to automate the creation of a UCloud UK8S Kubernetes cluster using the official ucloud-cli. It includes logic to check for, download, and install the ucloud-cli from its official GitHub repository (ucloud/ucloud-cli) if it is not present. The instructions in SKILL.md transparently guide the agent through configuring credentials, fetching network resources (VPC/Subnet), and executing the cluster creation API call. No evidence of malicious intent, data exfiltration, or obfuscation was found.
能力标签
requires-wallet
能力评估
Purpose & Capability
Name/description (create a UK8S cluster) align with the runtime steps: installing/using ucloud-cli, calling UK8S-related ucloud API actions, selecting VPC/Subnet, choosing K8s version and image, assembling CreateUK8SClusterV2 payload and invoking ucloud api. Required inputs (ucloud keys, region, zone, project id) are appropriate and expected for this task.
Instruction Scope
SKILL.md stays largely within the scope of cluster creation. It asks to read ucloud config and API responses, interactively prompt the user when needed, write a temp JSON to /tmp, and report results. Two operational concerns: (1) it instructs to record and ultimately display the plaintext cluster login password (this is necessary for login but increases exposure risk), and (2) it does not verify downloaded ucloud-cli with a checksum or signature. Neither is covert, but both are worth user attention.
Install Mechanism
No packaged install spec in registry — the SKILL.md contains a curl+unzip installation from GitHub releases (https://github.com/ucloud/ucloud-cli/releases/download/v0.3.0/...). Using a GitHub release URL is reasonable, but the instructions do not verify checksums/signatures and write the binary to $HOME/.local/bin, which is typical but should be reviewed by the user.
Credentials
The skill requires ucloud credentials and configuration (public/private keys, region, zone, project_id) which are directly needed to call ucloud APIs. It does not request unrelated environment variables, secrets, or config paths.
Persistence & Privilege
always is false, no install-time persistent agent changes are requested, and the skill does not attempt to modify other skills or system-wide agent settings. It only writes a temporary JSON and may add $HOME/.local/bin to PATH in the session when installing the CLI.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install uk8s
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /uk8s 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.1
1. 使用 GetUK8SVersions 自动获得 uk8s 版本 2. 设置 ucloud-cli 下载链接
v1.0.0
Initial release of the uk8s skill for automated UK8S Kubernetes cluster creation. - Provides step-by-step guidance to create a UK8S cluster via ucloud-cli. - Automatically discovers and selects VPC, Subnet, Kubernetes version, and image. - Generates default configuration; allows user input when needed. - Handles API calls, user prompts, error analysis, and final reporting. - Ensures secure password generation and clear result output.
元数据
Slug uk8s
版本 1.0.1
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 2
常见问题

uk8s 是什么?

创建 UK8S Kubernetes 集群。通过 ucloud-cli 调用 API,自动获取 VPC/Subnet/版本/镜像,生成配置并创建集群。Use when user wants to create a UK8S cluster. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 103 次。

如何安装 uk8s?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install uk8s」即可一键安装,无需额外配置。

uk8s 是免费的吗?

是的,uk8s 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

uk8s 支持哪些平台?

uk8s 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 uk8s?

由 HelloHJC(@hellohjc)开发并维护,当前版本 v1.0.1。

💬 留言讨论