huaweicloud/huaweicloud-skills

huawei-cloud-cce-cluster-management

Huawei Cloud CCE (Cloud Container Engine) cluster lifecycle management skill using hcloud CLI (KooCLI) for Huawei Cloud API calls and kubectl cce plugin for Kubernetes node operations (cordon/uncordon/drain/status).

Voir la source
Document Skill original

Rendu depuis le dépôt source en conservant titres, exemples, code, tableaux, liens et images.

Huawei Cloud CCE Cluster Management

Overview

Manage CCE (Cloud Container Engine) cluster lifecycle, including cluster creation/deletion/hibernation/awakening, node pool management, node scheduling control, and addon management.

The skill executes Huawei Cloud API calls through hcloud (KooCLI) and Kubernetes node operations (cordon/uncordon/drain/status) through kubectl cce (the kubectl-cce plugin). The plugin connects to the CCE API Gateway using AK/SK credentials — no cluster EIP or manual kubeconfig required. Two operations (create cluster, create node pool) fall back to the Python SDK because of a known hcloud metadata parsing defect — see cce-api-guide.md.

Dependency: This skill requires kubectl and the kubectl-cce plugin. Install them via the huawei-cloud-kubectl-cce-installer skill.

⛔ Security Constraints

Dangerous Operation Confirmation Mechanism

This skill strictly enforces a two-step confirmation mechanism for all dangerous operations to prevent accidental service disruption or data loss.

All dangerous operations require confirm=true parameter to execute. Otherwise, they return a preview and confirmation prompt.

Operations Requiring Confirmation

ToolOperation TypeRisk LevelDescription
huawei_delete_cce_clusterDelete🔴 CriticalDeletes entire CCE cluster, irreversible
huawei_hibernate_cce_clusterHibernate🟠 HighStops all workloads, pauses control plane billing
huawei_awake_cce_clusterAwake🟠 HighResumes cluster from hibernation
huawei_resize_cce_nodepoolScale🟡 MediumAdjusts node pool size, affects capacity
huawei_delete_cce_nodepoolDelete🟠 HighDeletes node pool, affects business capacity
huawei_delete_cce_nodeDelete🟠 HighRemoves node from cluster, affects scheduling
huawei_uninstall_cce_addonUninstall🟠 HighRemoves addon, may affect cluster functionality
huawei_cce_node_cordonCordon🟡 MediumMarks node unschedulable, new pods won't be assigned
huawei_cce_node_uncordonUncordon🟡 MediumMarks node schedulable, new pods may be assigned immediately
huawei_cce_node_drainDrain🟠 HighCordons + evicts all pods from node, affects running workloads

Workflow

Step 1: Preview Operation - Call without confirm parameter

bash
# Example: Preview cluster deletion
python3 huawei-cloud.py huawei_delete_cce_cluster \
  region=cn-north-4 \
  cluster_id=xxx

Returns: operation preview, risk warning, confirmation example

Step 2: Confirm Execution - Call with confirm=true

bash
# Example: Confirm and execute deletion
python3 huawei-cloud.py huawei_delete_cce_cluster \
  region=cn-north-4 \
  cluster_id=xxx \
  confirm=true

Credential Security

This skill strictly follows these security rules:

  1. No persistent credential storage - Never saves AK/SK, tokens, or certificates to disk
  2. No long-term memory cache - AK/SK exists only during API call, released afterward
  3. Only project ID memory cache - Non-sensitive project ID cached in process memory
  4. No credential leakage - Never includes AK/SK in logs, responses, or errors
  5. Temporary file cleanup - Temporary kubeconfig files are deleted immediately after use
  6. Config-first credential passing - If hcloud CLI config has credentials, AK/SK are not passed as CLI arguments (avoids ps aux exposure). Environment variables are only set for subprocesses if not already present in the parent environment.

Credentials are resolved from parameters or environment variables (process-level, never written to disk):

  • Permanent credentials: HW_ACCESS_KEY + HW_SECRET_KEY
  • Temporary credentials (recommended for CI/CD / IAM temporary access keys): HW_ACCESS_KEY + HW_SECRET_KEY + HW_SECURITY_TOKEN
  • HW_PROJECT_ID is optional — auto-fetched via hcloud IAM KeystoneListProjects when not provided (only for hcloud API calls; kubectl-cce node operations do not need it)
  • Per-call ak / sk parameters override the environment variables for that single call

Security hardening tip: Set HW_ACCESS_KEY / HW_SECRET_KEY in the parent process environment (e.g., ~/.bashrc or systemd environment file) so they are inherited by subprocesses without explicit passing. The skill detects existing env vars and skips passing AK/SK as CLI arguments to hcloud, preventing credential exposure in process listings (ps aux). kubectl-cce reads these env vars directly from the process environment.

bash
# Permanent
export HW_ACCESS_KEY  # your access key ID
export HW_SECRET_KEY  # your secret access key
export HW_REGION_NAME="cn-north-4"

# Temporary (add security token)
export HW_SECURITY_TOKEN  # your security token

Node Login Password Security

When creating nodes or node pools, the login credential is resolved with the following three-level priority:

  1. `ssh_key` parameter — SSH key pair name (preferred when available). Mutually exclusive with password.
  2. `password` parameter — raw node login password passed per call (8–26 chars, ≥3 of: uppercase / lowercase / digits / special).
  3. `CCE_NODE_PASSWORD` environment variable — used when neither ssh_key nor password is provided.
  4. Auto-generated random password — when none of the above is supplied, the skill generates a strong random password automatically.
⚠️ The auto-generated password is NEVER returned in the tool response (not in data, not in message, not in logs). To access the node afterwards, the user must reset the node password via the CCE console or the ECS API. The success message only contains a hint instructing the user to reset the password.

The raw password is never sent to the CCE API directly; the skill applies SHA-512 salted encryption + base64 encoding internally (see cce-cluster-parameters.md).


Prerequisites

CLI Tools

  • `hcloud` (Huawei Cloud KooCLI 7.2+) — drives all Huawei Cloud API calls. Install:
bash
  curl -sSL https://cn-north-4-hdn-koocli.obs.cn-north-4.myhuaweicloud.com/cli/latest/hcloud_install.sh -o ./hcloud_install.sh && bash ./hcloud_install.sh
  hcloud version   # verify install

`kubectl` + `kubectl-cce` plugin — required for node scheduling operations (cordon/uncordon/drain/status). Install via the huawei-cloud-kubectl-cce-installer skill:

bash
  # Check if already installed
  bash ../huawei-cloud-kubectl-cce-installer/scripts/install_kubectl_cce.sh --check

  # Install (after confirming the plan)
  sudo bash ../huawei-cloud-kubectl-cce-installer/scripts/install_kubectl_cce.sh --execute --bin-dir /usr/local/bin

The kubectl cce plugin connects through the CCE API Gateway using AK/SK credentials — no cluster EIP or manual kubeconfig needed.

Python Environment

  • Python 3.8+
  • Install SDK packages (retained for create-cluster / create-nodepool fallback) and helpers:
bash
  pip install huaweicloudsdkcce huaweicloudsdkcore huaweicloudsdkiam passlib pyyaml

passlib provides SHA-512 salting. huaweicloudsdkcce + huaweicloudsdkcore + huaweicloudsdkiam are used by the two SDK fallback functions (create cluster, create node pool) and IAM project-ID resolution. pyyaml parses hcloud JSON output.

Environment Variables

The skill detects existing environment variables before passing credentials to subprocesses:

  • hcloud CLI calls: if HW_ACCESS_KEY/HW_SECRET_KEY are already in os.environ, the skill skips passing --cli-access-key/--cli-secret-key as CLI arguments, preventing exposure in ps aux.
  • kubectl-cce calls: the plugin reads HW_ACCESS_KEY/HW_SECRET_KEY from the process environment directly. If these variables are already set, the subprocess inherits them naturally — the skill does not set them again.
🔒 Security Tip: Set HW_ACCESS_KEY/HW_SECRET_KEY at the system or session level (e.g., in ~/.bashrc or a systemd environment file) so the skill never needs to pass them as explicit CLI arguments. This eliminates the risk of credential exposure in process listings (ps aux) and shell history.
bash
# Set credentials at session level (the skill detects these and skips
# passing them as explicit CLI arguments to hcloud/kubectl-cce)
export HW_ACCESS_KEY  # your access key ID
export HW_SECRET_KEY  # your secret access key
export HW_REGION_NAME="cn-north-4"
# Optional, for temporary credentials:
export HW_SECURITY_TOKEN  # your security token
# Optional, for node login when ssh_key is not used:
export CCE_NODE_PASSWORD  # your node password (8-26 chars, at least 3 char categories)

IAM Permission Policies

Ensure the IAM user has the minimum required permissions:

PermissionDescription
cce:cluster:listList clusters
cce:cluster:getGet cluster details
cce:cluster:createCreate clusters
cce:cluster:deleteDelete clusters
cce:cluster:updateUpdate clusters (hibernate/awake/bind EIP)
cce:node:listList nodes
cce:node:getGet node details
cce:node:createCreate nodes
cce:node:deleteDelete nodes
cce:node:updateUpdate nodes (cordon/uncordon/drain)
cce:nodepool:listList node pools
cce:nodepool:createCreate node pools
cce:nodepool:deleteDelete node pools
cce:nodepool:updateUpdate node pools (resize)
cce:addon:listList addons
cce:addon:getGet addon details
cce:addon:createInstall addons
cce:addon:updateUpdate addons
cce:addon:deleteUninstall addons

参数确认

Before executing any command, confirm the following parameters with the user:

认证参数

ParameterEnv VariableRequiredDescription
Access Key IDHW_ACCESS_KEYHuawei Cloud AK, permanent or temporary credential
Secret Access KeyHW_SECRET_KEYHuawei Cloud SK, permanent or temporary credential
RegionHW_REGION_NAMERegion, e.g. cn-north-4
Security TokenHW_SECURITY_TOKENTemporary credential security token, STS only
Node PasswordCCE_NODE_PASSWORDNode login password, auto-generated if not set

集群参数

ParameterRequiredDefaultDescription
cluster_nameCluster name, recommended <env>-<app>-cluster
cluster_typeTurboCluster type (Turbo/VirtualMachine)
container_network_typeeniContainer network type, eni for Turbo clusters
cluster_versionAPI latestKubernetes version, auto-select latest if omitted
vpc_idVPC ID
subnet_idSubnet ID
flavor_idNode flavor, e.g. c7.large.2
confirmfalseDanger confirmation flag, required true for delete/hibernate/resize

节点池参数

ParameterRequiredDefaultDescription
nodepool_nameNode pool name, recommended <env>-<role>-pool
node_count2Initial node count, ≥2 recommended for HA
min_node_countAuto-scaling minimum
max_node_countAuto-scaling maximum
ssh_keySSH key pair name, takes priority over password
root_volume_size40Root disk size (GB)
data_volume_size100Data disk size (GB)

其他参数

ParameterRequiredDefaultDescription
duration30Kubeconfig validity period (days), pass as integer
eip_idautoEIP ID, auto-find or create if not provided
addon_idAddon ID (UID), required for detail query

Core Commands

Cluster Query

ToolFunctionParameters
huawei_list_cce_clustersList all CCE clusters in regionregion
huawei_get_cce_nodesGet detailed node informationregion, cluster_id
huawei_get_cce_kubeconfigGet cluster kubeconfigregion, cluster_id, duration

Cluster Management

ToolFunctionRisk LevelRequires Confirmation
huawei_create_cce_clusterCreate CCE cluster🟢 LowNo
huawei_delete_cce_clusterDelete CCE cluster🔴 CriticalYes
huawei_hibernate_cce_clusterHibernate cluster🟠 HighYes
huawei_awake_cce_clusterAwake cluster🟠 HighNo
huawei_bind_cce_cluster_eipBind cluster EIP (auto-find/create if no eip_id)🟢 LowNo
huawei_unbind_cce_cluster_eipUnbind cluster EIP🟡 MediumNo
Dynamic EIP Binding: huawei_bind_cce_cluster_eip supports dynamic EIP assignment. If eip_id is not provided, the skill automatically: (1) lists existing EIPs and finds an unbound one (status=DOWN), (2) if none available, creates a new EIP (traffic billing, 5Mbps, PER share type), (3) binds it to the cluster. The response includes eip_created (true/false), eip_id, eip_address, and public_endpoint (the External API URL).

Recommended defaults:

  • Cluster type: Turbo (best performance with ENI network)
  • Container network: eni for Turbo clusters (default in this skill)
  • Cluster version: omit `cluster_version` to let the API pick the latest supported version; specify it only when the user requires a specific Kubernetes version
  • Naming format: <env>-<app>-cluster (e.g., prod-web-cluster)

Node Pool Management

ToolFunctionRisk LevelRequires Confirmation
huawei_list_cce_nodepoolsList node pools🟢 LowNo
huawei_create_cce_nodepoolCreate node pool🟢 LowNo
huawei_delete_cce_nodepoolDelete node pool🟠 HighYes
huawei_resize_cce_nodepoolResize node pool🟡 MediumYes

Recommended defaults:

  • Naming format: <env>-<role>-pool (e.g., prod-worker-pool)
  • Initial node count: 2 for HA, or 0 with autoscaling
  • Enable autoscaling for dynamic scaling
  • For Turbo clusters, use ENI-compatible flavors (e.g., c7.large.2)

Node Management

ToolFunctionRisk LevelRequires Confirmation
huawei_list_cce_nodesList cluster nodes🟢 LowNo
huawei_create_cce_nodeCreate nodes directly🟢 LowNo
huawei_delete_cce_nodeDelete node🟠 HighYes
huawei_cce_node_cordonMark node unschedulable🟡 MediumYes
huawei_cce_node_uncordonMark node schedulable🟡 MediumYes
huawei_cce_node_drainCordon + evict all pods from node🟠 HighYes
huawei_cce_node_statusQuery node scheduling status🟢 LowNo
Node ID note: huawei_delete_cce_node requires the node UID (from huawei_list_cce_nodesmetadata.uid), not the node name. Using a name instead of UID will return an error.

Node scheduling operations (cordon, uncordon, drain, status) are executed via kubectl cce — the kubectl-cce plugin connects to the CCE API Gateway using AK/SK credentials. No cluster EIP or manual kubeconfig required. The plugin handles cordon, eviction, PodDisruptionBudget (PDB) compliance, and DaemonSet pod skipping natively.

huawei_cce_node_drain follows standard drain semantics: it first cordons the node, then evicts all resident pods (excluding DaemonSet pods) via the k8s Eviction API, which respects PodDisruptionBudget (PDB). Pods blocked by PDB will be reported in the failed_pods field.

Note: Prefer node pools for managed scaling. Direct node creation is for special cases.

Addon Management

ToolFunctionRisk LevelRequires Confirmation
huawei_list_cce_addonsList cluster addons🟢 LowNo
huawei_get_cce_addon_detailGet addon details🟢 LowNo
huawei_install_cce_addonInstall addon🟢 LowNo
huawei_uninstall_cce_addonUninstall addon🟠 HighYes
huawei_update_cce_addonUpdate addon🟡 MediumNo

Common addons:

  • coredns - DNS service
  • metrics-server - Monitoring metrics
  • everest - Storage driver
Addon notes (from E2E verification): - huawei_get_cce_addon_detail, huawei_uninstall_cce_addon, and huawei_update_cce_addon all require the addon UID (from huawei_list_cce_addonsmetadata.uid), not the addon name. Using a name instead of UID will return error CCE.03400001. - Addon status is in the status.status field (e.g., running, upgrading, abnormal), not spec.status. - After huawei_update_cce_addon, the addon may enter upgrading state. Wait for it to return to running before performing subsequent operations (e.g., uninstall).

Network Prerequisites

ToolFunctionParameters
huawei_list_vpcList VPCs with CIDR inforegion
huawei_list_vpc_subnetsList subnets with AZ inforegion, vpc_id(optional)
huawei_list_eipsList EIPs (shows bound/unbound status)region
huawei_delete_eipDelete an EIP (frees public IP)region, publicip_id

Use these tools to find VPC/subnet IDs before cluster creation.


Supported Regions

Region CodeRegion Name
cn-north-4North China-Beijing 4
cn-north-1North China-Beijing 1
cn-north-2North China-Beijing 2
cn-east-3East China-Shanghai 1
cn-south-1South China-Guangzhou
cn-south-2South China-Guangzhou Friendly
cn-east-4East China II
cn-southwest-2Guiyang 1
ap-southeast-1Asia-Pacific-Hong Kong
ap-southeast-2Asia-Pacific-Bangkok
ap-southeast-3Asia-Pacific-Singapore

Output Format

All tools return JSON-formatted results containing:

  • status: operation result (success / error)
  • data: operation-specific response (cluster info, node list, addon details, etc.)
  • message: human-readable description of the result
  • warning: risk warning for dangerous operations (preview mode only)

Verification

See verification-method.md for detailed verification steps. Quick checklist:

  1. hcloud version (should be 7.2+)
  2. kubectl version --client
  3. Verify HW_ACCESS_KEY / HW_SECRET_KEY env vars are set (add HW_SECURITY_TOKEN for temporary credentials)
  4. hcloud CCE ListClusters --cli-region=cn-north-4 (connectivity test)
  5. Test dangerous operation preview (call without confirm=true)

Best Practices

  • Use environment variables (HW_ACCESS_KEY / HW_SECRET_KEY) for credentials — avoid hardcoding; add HW_SECURITY_TOKEN for temporary credentials
  • Always preview dangerous operations before confirming with confirm=true
  • Prefer Turbo clusters (container_network_type=eni) — the default — for high-performance workloads
  • Omit cluster_version unless the user requires a specific Kubernetes version
  • Resize node pools during low-traffic periods to minimize business impact
  • Keep node pools at ≥2 nodes for production workloads to ensure redundancy
  • Regularly check cluster health via huawei_list_cce_clusters

References

DocumentDescription
task-cluster-management.mdCluster lifecycle operations
task-nodepool-management.mdNode pool operations
task-node-management.mdNode scheduling operations
iam-policies.mdIAM permission policies
verification-method.mdVerification steps
troubleshooting.mdTroubleshooting guide
cce-api-guide.mdhcloud operation reference
cce-cluster-parameters.mdCluster/nodepool creation parameters
cli-installation-guide.mdCLI installation and configuration guide

Notes

  • Ensure AK/SK (and HW_SECURITY_TOKEN for temporary credentials) has correct IAM permissions
  • Different regions may have different resource availability
  • All dangerous operations require confirmation
  • Deletion operations are irreversible
  • Hibernate cluster stops all workloads - use during non-business hours
  • Node drain uses kubectl drain natively: handles cordon + eviction + PDB compliance + DaemonSet skip automatically. Use --ignore-daemonsets --delete-emptydir-data flags.
  • Turbo clusters recommended for best performance with ENI network
  • Create cluster / create node pool use the Python SDK fallback due to a known hcloud metadata parsing defect; all other operations use hcloud CLI
du même dépôt

Autres Skills

Tous les Skills
huaweicloud
Communauté

huawei-cloud-publish-work-to-gallery

Publish user's work to the Huawei Cloud University Operations Platform (华为云高校运营平台/作品陈列馆). Use this skill whenever the user wants to publish, submit, or upload a project/work to the gallery or a training camp (训练营) on the platform — including casual phrasings like "把作品发布上去", "投稿到陈列馆", "传作品到平台", "提交作品/项目", "报名发布作品", as well as formal ones like "publish to work gallery", "submit to training camp", "upload work to the platform". Do NOT use for general dev questions, git push to GitCode alone, or platform browsing without publishing intent.

installations
5
GitHub Stars
50
Mis à jour
23 sept.
huaweicloud
Communauté

huawei-cloud-eip-cost-optimizer

Huawei Cloud EIP (Elastic IP) cost optimization skill using hcloud CLI (KooCLI). 1. List and query EIPs across regions with detailed status 2. Identify idle/unbound EIPs and generate cost optimization reports 3. Set up idle EIP monitoring with webhook/email alerts 4. Generate HTML/JSON cost analysis reports 5. Maintain operation audit logs for compliance Read-only analysis only - NO bandwidth adjustment, tag management, or EIP release/deletion. Triggers include: "EIP cost optimization", "idle EIP analysis", "EIP audit", "cost report", "EIP status query", "EIP list", "EIP monitoring", "EIP alert", "cost analysis", "idle monitoring", "operation audit", "EIP 成本优化", "闲置 EIP 分析", "EIP 审计", "成本报告", "EIP 状态查询", "EIP 查询", "EIP 列表", "EIP 监控", "EIP 告警", "成本分析", "闲置监控", "操作审计"

installations
1
GitHub Stars
50
Mis à jour
22 sept.
huaweicloud
Communauté

huawei-cloud-flexus-l-deploy-jiuwenswarm

One-click deployment of JiuwenSwarm multi-Agent collaboration platform on Huawei Cloud Flexus L instances. Usage scenarios: When users need to quickly deploy JiuwenSwarm/JiuwenClaw on Huawei Cloud Flexus L instances, when they need to automatically create cloud instances and deploy AI Agent platforms, when they need to configure model APIs and message channels (Xiaoyi/Feishu/DingTalk). Automatically create instances, deploy applications via COC, configure models and message channels. Trigger keywords: JiuwenSwarm deployment, JiuwenClaw deployment, 九问Swarm部署, 九问Claw部署, 一键部署JiuwenSwarm, AI智能体平台部署, 部署九问Swarm, 部署九问Claw,云服务器部署AI平台.

installations
1
GitHub Stars
50
Mis à jour
22 sept.
huaweicloud
Communauté

huawei-cloud-flexus-l-server-flexusagent-deployment

Deploy AI Agent development platform (Dify) on Huawei Cloud Flexus L instance, providing deployment operations, password management, MaaS model configuration, and workflow import capabilities. Trigger keywords: deploy flexusagent/一键部署Flexus AI Agent开发平台、change password/修改开发平台管理员密码、change dify password/修改dify平台密码、add maas provider/添加MaaS模型供应商、configure maas model/配置MaaS模型、view workflow/查看AI Agent工作流、import workflow/导入AI Agent工作流

installations
1
GitHub Stars
50
Mis à jour
22 sept.