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
and the
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
parameter to execute. Otherwise, they return a preview and confirmation prompt.
Operations Requiring Confirmation
| Tool | Operation Type | Risk Level | Description |
|---|
huawei_delete_cce_cluster
| Delete | 🔴 Critical | Deletes entire CCE cluster, irreversible |
huawei_hibernate_cce_cluster
| Hibernate | 🟠 High | Stops all workloads, pauses control plane billing |
| Awake | 🟠 High | Resumes cluster from hibernation |
huawei_resize_cce_nodepool
| Scale | 🟡 Medium | Adjusts node pool size, affects capacity |
huawei_delete_cce_nodepool
| Delete | 🟠 High | Deletes node pool, affects business capacity |
| Delete | 🟠 High | Removes node from cluster, affects scheduling |
huawei_uninstall_cce_addon
| Uninstall | 🟠 High | Removes addon, may affect cluster functionality |
| Cordon | 🟡 Medium | Marks node unschedulable, new pods won't be assigned |
| Uncordon | 🟡 Medium | Marks node schedulable, new pods may be assigned immediately |
| Drain | 🟠 High | Cordons + evicts all pods from node, affects running workloads |
Workflow
Step 1: Preview Operation - Call without
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
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:
- No persistent credential storage - Never saves AK/SK, tokens, or certificates to disk
- No long-term memory cache - AK/SK exists only during API call, released afterward
- Only project ID memory cache - Non-sensitive project ID cached in process memory
- No credential leakage - Never includes AK/SK in logs, responses, or errors
- Temporary file cleanup - Temporary kubeconfig files are deleted immediately after use
- Config-first credential passing - If hcloud CLI config has credentials, AK/SK are not passed as CLI arguments (avoids 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: +
- Temporary credentials (recommended for CI/CD / IAM temporary access keys): + +
- 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 / parameters override the environment variables for that single call
Security hardening tip: Set
/
in the parent process environment (e.g.,
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 (
). 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:
- parameter — SSH key pair name (preferred when available). Mutually exclusive with password.
- parameter — raw node login password passed per call (8–26 chars, ≥3 of: uppercase / lowercase / digits / special).
- environment variable — used when neither nor is provided.
- 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
, not in
, 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
-
(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
+ 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
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
provides SHA-512 salting.
+
+
are used by the two SDK fallback functions (create cluster, create node pool) and IAM project-ID resolution.
parses hcloud JSON output.
Environment Variables
The skill detects existing environment variables before passing credentials to subprocesses:
- hcloud CLI calls: if / are already in , the skill skips passing / as CLI arguments, preventing exposure in .
- kubectl-cce calls: the plugin reads / 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
/
at the system or session level (e.g., in
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 (
) 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-password"
IAM Permission Policies
Ensure the IAM user has the minimum required permissions:
| Permission | Description |
|---|
| List clusters |
| Get cluster details |
| Create clusters |
| Delete clusters |
| Update clusters (hibernate/awake/bind EIP) |
| List nodes |
| Get node details |
| Create nodes |
| Delete nodes |
| Update nodes (cordon/uncordon/drain) |
| List node pools |
| Create node pools |
| Delete node pools |
| Update node pools (resize) |
| List addons |
| Get addon details |
| Install addons |
| Update addons |
| Uninstall addons |
参数确认
Before executing any command, confirm the following parameters with the user:
认证参数
| Parameter | Env Variable | Required | Description |
|---|
| Access Key ID | | ✅ | Huawei Cloud AK, permanent or temporary credential |
| Secret Access Key | | ✅ | Huawei Cloud SK, permanent or temporary credential |
| Region | | ✅ | Region, e.g. |
| Security Token | | ❌ | Temporary credential security token, STS only |
| Node Password | | ❌ | Node login password, auto-generated if not set |
集群参数
| Parameter | Required | Default | Description |
|---|
| ✅ | — | Cluster name, recommended |
| ❌ | | Cluster type (Turbo/VirtualMachine) |
| ❌ | | Container network type, for Turbo clusters |
| ❌ | API latest | Kubernetes version, auto-select latest if omitted |
| ✅ | — | VPC ID |
| ✅ | — | Subnet ID |
| ✅ | — | Node flavor, e.g. |
| ❌ | | Danger confirmation flag, required for delete/hibernate/resize |
节点池参数
| Parameter | Required | Default | Description |
|---|
| ✅ | — | Node pool name, recommended |
| ❌ | | Initial node count, ≥2 recommended for HA |
| ❌ | — | Auto-scaling minimum |
| ❌ | — | Auto-scaling maximum |
| ❌ | — | SSH key pair name, takes priority over password |
| ❌ | | Root disk size (GB) |
| ❌ | | Data disk size (GB) |
其他参数
| Parameter | Required | Default | Description |
|---|
| ❌ | | Kubeconfig validity period (days), pass as integer |
| ❌ | auto | EIP ID, auto-find or create if not provided |
| ❌ | — | Addon ID (UID), required for detail query |
Core Commands
Cluster Query
| Tool | Function | Parameters |
|---|
| List all CCE clusters in region | |
| Get detailed node information | , |
huawei_get_cce_kubeconfig
| Get cluster kubeconfig | , , |
Cluster Management
| Tool | Function | Risk Level | Requires Confirmation |
|---|
huawei_create_cce_cluster
| Create CCE cluster | 🟢 Low | No |
huawei_delete_cce_cluster
| Delete CCE cluster | 🔴 Critical | Yes |
huawei_hibernate_cce_cluster
| Hibernate cluster | 🟠 High | Yes |
| Awake cluster | 🟠 High | No |
huawei_bind_cce_cluster_eip
| Bind cluster EIP (auto-find/create if no eip_id) | 🟢 Low | No |
huawei_unbind_cce_cluster_eip
| Unbind cluster EIP | 🟡 Medium | No |
Dynamic EIP Binding: huawei_bind_cce_cluster_eip
supports dynamic EIP assignment. If
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
(true/false),
,
, and
(the External API URL).
Recommended defaults:
- Cluster type: (best performance with ENI network)
- Container network: for Turbo clusters (default in this skill)
- Cluster version: omit to let the API pick the latest supported version; specify it only when the user requires a specific Kubernetes version
- Naming format: (e.g., )
Node Pool Management
| Tool | Function | Risk Level | Requires Confirmation |
|---|
huawei_list_cce_nodepools
| List node pools | 🟢 Low | No |
huawei_create_cce_nodepool
| Create node pool | 🟢 Low | No |
huawei_delete_cce_nodepool
| Delete node pool | 🟠 High | Yes |
huawei_resize_cce_nodepool
| Resize node pool | 🟡 Medium | Yes |
Recommended defaults:
- Naming format: (e.g., )
- Initial node count: 2 for HA, or 0 with autoscaling
- Enable autoscaling for dynamic scaling
- For Turbo clusters, use ENI-compatible flavors (e.g., )
Node Management
| Tool | Function | Risk Level | Requires Confirmation |
|---|
| List cluster nodes | 🟢 Low | No |
| Create nodes directly | 🟢 Low | No |
| Delete node | 🟠 High | Yes |
| Mark node unschedulable | 🟡 Medium | Yes |
| Mark node schedulable | 🟡 Medium | Yes |
| Cordon + evict all pods from node | 🟠 High | Yes |
| Query node scheduling status | 🟢 Low | No |
Node scheduling operations (
,
,
,
) 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.
follows
standard drain semantics: it first cordons the node, then evicts all resident pods (excluding DaemonSet pods) via the k8s Eviction API, which respects
(PDB). Pods blocked by PDB will be reported in the
field.
Note: Prefer node pools for managed scaling. Direct node creation is for special cases.
Addon Management
| Tool | Function | Risk Level | Requires Confirmation |
|---|
| List cluster addons | 🟢 Low | No |
huawei_get_cce_addon_detail
| Get addon details | 🟢 Low | No |
| Install addon | 🟢 Low | No |
huawei_uninstall_cce_addon
| Uninstall addon | 🟠 High | Yes |
| Update addon | 🟡 Medium | No |
Common addons:
- - DNS service
- - Monitoring metrics
- - Storage driver
Addon notes (from E2E verification):
huawei_get_cce_addon_detail
and huawei_uninstall_cce_addon
require the addon UID (from → ), not the addon name.
- Addon status is in the field (e.g., , , ), not .
- After , the addon may enter state. Wait for it to return to before performing subsequent operations (e.g., uninstall).
Network Prerequisites
| Tool | Function | Parameters |
|---|
| List VPCs with CIDR info | |
| List subnets with AZ info | , (optional) |
| List EIPs (shows bound/unbound status) | |
| Delete an EIP (frees public IP) | , |
Use these tools to find VPC/subnet IDs before cluster creation.
Supported Regions
| Region Code | Region Name |
|---|
| cn-north-4 | North China-Beijing 4 |
| cn-north-1 | North China-Beijing 1 |
| cn-north-2 | North China-Beijing 2 |
| cn-east-3 | East China-Shanghai 1 |
| cn-south-1 | South China-Guangzhou |
| cn-south-2 | South China-Guangzhou Friendly |
| cn-east-4 | East China II |
| cn-southwest-2 | Guiyang 1 |
| ap-southeast-1 | Asia-Pacific-Hong Kong |
| ap-southeast-2 | Asia-Pacific-Bangkok |
| ap-southeast-3 | Asia-Pacific-Singapore |
Output Format
All tools return JSON-formatted results containing:
- : operation result ( / )
- : operation-specific response (cluster info, node list, addon details, etc.)
- : human-readable description of the result
- : risk warning for dangerous operations (preview mode only)
Verification
See verification-method.md for detailed verification steps. Quick checklist:
- (should be 7.2+)
- Verify / env vars are set (add for temporary credentials)
hcloud CCE ListClusters --cli-region=cn-north-4
(connectivity test)
- Test dangerous operation preview (call without )
Best Practices
- Use environment variables ( / ) for credentials — avoid hardcoding; add for temporary credentials
- Always preview dangerous operations before confirming with
- Prefer Turbo clusters (
container_network_type=eni
) — the default — for high-performance workloads
- Omit 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
References
| Document | Description |
|---|
| task-cluster-management.md | Cluster lifecycle operations |
| task-nodepool-management.md | Node pool operations |
| task-node-management.md | Node scheduling operations |
| iam-policies.md | IAM permission policies |
| verification-method.md | Verification steps |
| troubleshooting.md | Troubleshooting guide |
| cce-api-guide.md | hcloud operation reference |
| cce-cluster-parameters.md | Cluster/nodepool creation parameters |
Notes
- Ensure AK/SK (and 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 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