| name | cloudstack-cmk |
|---|---|
| description | Apache CloudStack management via `cmk` (CloudMonkey) CLI |
Purpose: Manage Apache CloudStack resources via the cmk CLI tool.
- User asks to manage CloudStack cloud environment like list/start/stop/delete VMs, Kubernetes clusters, or other CloudStack resources
- Need to query CloudStack infrastructure (zones, networks, templates)
- Managing CKS (CloudStack-managed Kubernetes) clusters
- Resource type:
virtualmachine,kubernetescluster,user, etc. - Action verb:
list,start,stop,delete,destroy - Sample parameters:
id=<UUID>,domainid=...,namepattern=...
- Resource listings (JSON/table)
- Operation status/confirmation
- Always run:
which cmkfirst to verify binary exists - Always use:
-p localcloudflag for profile context but it can be changed by the user to another cloud profile name - Destructive operations (
delete*,destroy*,expunge*,purge) → ALWAYS requires explicit user confirmation ("yes" or "approve") before executing, regardless of resource type- Examples:
deleteVpc,deleteNetwork,destroyVirtualMachine,expungeVolume
- Examples:
- Standard lifecycle ops (start, stop, update, list) → standard confirmation only
Note: Some resources (VMs, volumes) have a destroy→expunge lifecycle (~24h default). They sit in "Destroyed" state and can be recovered via recover* APIs until permanently expunged. Networks/VPCs/IPs delete immediately without recovery window.
- Unknown commands? Run
cmk -p localcloud syncto refresh API cache at~/.cmk/profiles/localcloud.cache - Query parameters via:
<verb> <resource> -h(e.g.,list users -h) - Discover APIs via Cache: Use
jqto explore the JSON cache and discover all supported APIs. Once you find an API, you can translate it into a standardcmk <verb> <resource>command. For example:- List all APIs starting with "list":
jq '.api[] | select(.name | startswith("list"))' ~/.cmk/profiles/localcloud.cache - Find Kubernetes-related APIs:
jq -r '.api[] | select(. .name | ascii_downcase | contains("kubernetes")) | .name' ~/.cmk/profiles/localcloud.cache
- List all APIs starting with "list":
Note: The default path is ~/.cmk/profiles/localcloud.cache, but you should replace localcloud.cache with <profile-name>.cache if using a different profile.
- Verify:
which cmk - Construct command:
cmk -p localcloud <verb> <resource> [args] - For params help: append
-hflag - Execute via
exectool - Parse JSON output with
jqif needed
| Action | Command |
|---|---|
| List VMs | cmk -p localcloud list virtualmachines domainid=<UUID> |
| Start VM | cmk -p localcloud start virtualmachine id=<UUID> |
| Stop CKS cluster | cmk -p localcloud stop kubernetescluster id=<UUID> |
| List clusters | cmk -p localcloud list kubernetesclusters |
- Run
destroy/purgewithout explicit/approve:yes/no - Skip
which cmkverification — binary may be missing from PATH - Always run
cmk -p localcloud syncon new setups to ensure the API cache is up to date.