Huawei Cloud CCE Query Skill
Overview
This skill provides read-only query capabilities for Huawei Cloud CCE (Cloud Container Engine, the managed Kubernetes service). It lists all clusters in a project with their names, IDs, status, version and flavor, shows a single cluster's detail, and lists nodes for a given cluster. It is designed for inventory reporting, daily inspection, and quick name lookups.
Architecture:
Agent → hcloud CLI (primary) → Huawei Cloud CCE API
↘ Python SDK (fallback) ↗
Applicable Scenarios:
- Inventory all CCE clusters and collect their names in a region
- Check cluster health/status (Available, Creating, Upgrading, Deleting, etc.)
- Retrieve a specific cluster's detail by ID or name
- List the nodes inside a cluster for capacity/usage review
Prerequisites
- hcloud CLI installed and authenticated — See
references/cli-installation-guide.md - Python 3.8+ with
huaweicloudsdkccepackage (SDK fallback) - Huawei Cloud AK/SK configured via environment variables or
hcloud configure set - IAM permissions —
CCE ReadOnlyAccessor finer-grained policy — Seereferences/iam-policies.md
Workflow
- Identify query scope — Decide whether to list all clusters, show one cluster detail, or list nodes of a cluster
- Select execution mode — Use the hcloud CLI by default; fall back to the Python SDK if the CLI is unavailable
- Execute the query — Run the appropriate command and capture the response
- Present results — Summarize cluster names, IDs, statuses and node counts in a readable form
Core Commands
Cluster Queries
| Purpose | Command |
|---|---|
| List all CCE clusters (names, IDs, status) | hcloud CCE ListClusters --cli-region={region} |
| List clusters with a status filter | hcloud CCE ListClusters --cli-region={region} --status={status} |
| List clusters of a given type | hcloud CCE ListClusters --cli-region={region} --type={type} |
| List clusters with node/addon detail | hcloud CCE ListClusters --cli-region={region} --detail=true |
| Show a single cluster's detail | hcloud CCE ShowCluster --cli-region={region} --cluster_id={cluster_id} |
Node Queries
| Purpose | Command |
|---|---|
| List nodes in a cluster | hcloud CCE ListNodes --cli-region={region} --cluster_id={cluster_id} |
| Show a single node's detail | hcloud CCE ShowNode --cli-region={region} --cluster_id={cluster_id} --node_id={node_id} |
Name-Only Lookup (jq)
To extract just the cluster names:
hcloud CCE ListClusters --cli-region={region} | jq -r '.items[].metadata.name'
SDK Fallback Examples
When the CLI is unavailable, use the Python SDK:
import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkcce.v3.region.cce_region import CceRegion
from huaweicloudsdkcce.v3 import CceClient, ListClustersRequest
credentials = BasicCredentials() \
.with_ak(os.getenv("HUAWEI_ACCESS_KEY")) \
.with_sk(os.getenv("HUAWEI_SECRET_KEY")) \
.with_project_id("{project_id}")
client = CceClient.new_builder() \
.with_credentials(credentials) \
.with_region(CceRegion.value_of("{region}")) \
.build()
request = ListClustersRequest()
response = client.list_clusters(request)
for cluster in response.items:
print(cluster.metadata.name, cluster.status.phase)
Parameter Confirmation
| Parameter | Required | Description | Example |
|---|---|---|---|
{region} |
Yes | Huawei Cloud region | cn-north-4 |
{cluster_id} |
Conditional | CCE cluster ID (required for ShowCluster/ListNodes) | 0ef72478-4e7e-11f1-a40f-0255ac100246 |
{node_id} |
Conditional | CCE node ID (required for ShowNode) | d4f16c73-... |
{status} |
No | Cluster status filter | Available |
{type} |
No | Cluster type filter | VirtualMachine |
{project_id} |
Conditional | Project ID (required for SDK/API) | 0a1234b56c78d9ef |
Reference Documents
KooCLI Command Format Standard
hcloud CCE <Operation> --cli-region=<region> [--key=value ...]
| Feature | Description | Example |
|---|---|---|
| Service name | CCE |
hcloud CCE ListClusters |
| Operation name | PascalCase | ListClusters, ShowCluster, ListNodes |
| Region parameter | --cli-region=<value> |
--cli-region=cn-north-4 |
| Simple parameter | --key=value |
--cluster_id=xxx |
