/rh-virt:vm-createfrom rh-virt
Create new virtual machines in OpenShift Virtualization with automatic instance type resolution and OS selection. Use when: - "Create a new VM" - "Deploy a virtual machine with [OS]" - "Set up a VM in namespace [name]" - "Provision a [size] VM" This skill handles VM creation with intelligent defaults for OpenShift Virtualization. NOT for managing existing VMs (use vm-lifecycle-manager or vm-delete instead).
Ships in rh-virt. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Create virtual machines in OpenShift Virtualization using the vm_create tool from the openshift-virtualization MCP server.
Required MCP Server: openshift-virtualization (OpenShift MCP Server)
Required MCP Tools:
vm_create (from openshift-virtualization) - Create VirtualMachine resourcesresources_get (from openshift-virtualization) - Check VM existence and statusresources_list (from openshift-virtualization) - List StorageClassesnamespaces_list (from openshift-virtualization) - List available namespacesevents_list (from openshift-virtualization) - Diagnostic event gatheringvm_lifecycle (from openshift-virtualization) - VM restart for workaroundsRequired Environment Variables:
KUBECONFIG - Path to Kubernetes configuration file with cluster accessRequired Cluster Setup:
Before executing:
openshift-virtualization exists in mcps.json → If missing, report setup instructionsKUBECONFIG is set (check presence only, never expose value) → If missing, report to userHuman Notification Protocol: ❌ Cannot execute vm-create: MCP server 'openshift-virtualization' not available. Setup: Add to mcps.json, set KUBECONFIG env var, restart Claude Code. Docs: https://github.com/openshift/openshift-mcp-server
⚠️ SECURITY: Never display KUBECONFIG path or credential values.
Trigger this skill when:
/vm-create commandUser phrases:
Do NOT use when:
/vm-lifecycle-manager/vm-inventory/vm-deleteDetermine missing parameters:
Required: VM Name (validate: lowercase, alphanumeric+hyphens, start letter, max 63 chars, unique), Namespace Optional (use defaults): OS (fedora), Size (medium), Storage (30Gi), Performance (u1), Autostart (false)
Gather cluster info:
namespaces_list (from openshift-virtualization) — ask user to select if not providedresources_list with apiVersion="storage.k8s.io/v1", kind="StorageClass"storageclass.kubernetes.io/is-default-class="true".volumeBindingMode (Immediate/WaitForFirstConsumer), provisioner (rbd/cephfs=RWX hint)If parameters missing, use AskUserQuestion tool with questions for: VM Name (custom input with validation), Namespace (current + list), OS (fedora/ubuntu/rhel/centos-stream/debian/opensuse), Performance (u1/c1/m1/o1), Size (small/medium/large/xlarge), Storage (30Gi/50Gi/100Gi/custom), StorageClass (dynamic list with hints), Autostart (yes/no). See Example Usage for complete JSON structure.
Process responses - map labels to values:
"fedora", "Ubuntu"→"ubuntu", "RHEL"→"rhel", "CentOS Stream"→"centos-stream", "Debian"→"debian", "OpenSUSE"→"opensuse""u1", "Compute (c1)"→"c1", "Memory (m1)"→"m1", "Overcommitted (o1)"→"o1""small", "Medium"→"medium", "Large"→"large", "XLarge"→"xlarge"false, "Yes"→trueMCP Tool: resources_get (from openshift-virtualization)
Parameters: apiVersion="kubevirt.io/v1", kind="VirtualMachine", namespace=<namespace>, name=<vm-name>
If VM exists:
⚠️ VM `<name>` already exists in namespace `<namespace>`
Status: <status>
Options: 1) Different name, 2) Delete existing, 3) Cancel
STOP and wait for user decision.
If not exists: Proceed to Step 3.
Display configuration table:
## Virtual Machine Configuration
| Parameter | Value | Notes |
|-----------|-------|-------|
| VM Name | `<name>` | validated |
| Namespace | `<namespace>` | from user/context |
| OS | `<os>` | from selection |
| Performance | `<perf>` | default: u1 |
| Size | `<size>` | default: medium |
| Storage | `<storage>` | default: 30Gi |
| StorageClass | `<sc>` | default: cluster default |
| Autostart | `<yes/no>` | default: no |
This will create a VirtualMachine consuming cluster resources.
Confirm: yes/no/modify
WAIT for explicit user confirmation before proceeding.
MCP Tool: vm_create (from openshift-virtualization)
Parameters:
namespace: <namespace> - REQUIREDname: <vm-name> - REQUIREDworkload: <os> - OPTIONAL (default: fedora)size: <size> - OPTIONAL (small/medium/large/xlarge)storage: <storage> - OPTIONAL (default: 30Gi)performance: <perf> - OPTIONAL (u1/c1/m1/o1)autostart: <bool> - OPTIONAL (default: false)Example: vm_create({"namespace": "vms", "name": "web-server", "workload": "fedora", "size": "medium", "storage": "50Gi", "autostart": false})
Error Handling:
Wait 5-10 seconds, then check status:
MCP Tool: resources_get (apiVersion="kubevirt.io/v1", kind="VirtualMachine", name=<name>, namespace=<namespace>)
Extract: .status.printableStatus
Status interpretation:
CRITICAL: Document Consultation FIRST:
Gather diagnostics:
events_list (namespace=<namespace>) → Filter for VM/VMIresources_get → Check .status.conditionsresources_list (apiVersion="v1", kind="Node") → Extract .spec.taintsParse root cause:
Present diagnosis:
## ⚠️ VM Scheduling Issue Detected
**Status**: ErrorUnschedulable | **Root Cause**: <identified-cause> | **Details**: <specifics>
### Recommended Solution
<workaround-description>
**Action**: Update VM via `resources_create_or_update`
**Impact**: <what-changes>
**Options**: 1) Apply workaround, 2) Manual, 3) Cancel, 4) Ignore
⚠️ MCP limitation: vm_create doesn't support tolerations
Wait for user decision.
If user confirms:
resources_create_or_update (fetch, add tolerations, update)resources_get → Check .spec.template.spec.tolerationsvm_lifecycle (action="restart") to apply new specReport: ## ✓ Workaround Applied | **Action**: Added tolerations, restarted | **Status**: <current>
On success:
## ✓ Virtual Machine Created Successfully
**VM**: `<name>` (namespace: `<namespace>`)
**OS**: <os> | **Size**: <size> (<perf>) | **Storage**: <storage> | **Status**: <status>
**Provisioning**: ~2-5 min (Provisioning → Stopped)
### Next Steps
Start: "Start VM <name>" | View: "Show VM <name>"
### Accessing the VM
1. Serial: `virtctl console <name> -n <ns>`
2. VNC: OpenShift Console → Virtualization → VMs → <name> → Console
3. SSH: Get IP from VMI, `ssh <user>@<ip>`
4. Port Forward: `virtctl port-forward vmi/<name> -n <ns> 8080:80`
### Default Credentials
- Fedora: fedora | Ubuntu: ubuntu | RHEL: cloud-user | CentOS: centos | Debian: debian
- All require SSH key or console password set: `virtctl console <name>`, `sudo passwd <user>`
On failure:
## ❌ Failed to Create Virtual Machine
**Error**: <error-message>
**Common Causes**:
- Namespace not exists → Create via `resources_create_or_update`
- RBAC denied → Check ServiceAccount permissions
- Resource constraints → Try smaller size
- Invalid parameters → Verify OS, size, storage format
- Operator not installed → Verify CSVs
Troubleshooting: See Common Issues
Error: "Namespace 'xyz' not found"
Solution: List with namespaces_list, create with resources_create_or_update
Error: "Forbidden: User cannot create VirtualMachines" Solution: Verify KUBECONFIG RBAC, requires create VirtualMachine permissions, contact admin
Error: "0/N nodes: Insufficient cpu/memory"
Solution: Check nodes_top, try smaller size (medium→small, o1 overcommitted), scale cluster
Error: "0/N nodes: taints pod didn't tolerate" Solution: Apply tolerations workaround (Step 5a), restart VM
Error: "PVC pending" or "StorageClass not found"
Solution: Verify SC (resources_list), check default annotation, verify provisioner, check quotas
Error: "DataVolume import failed" or "image pull error" Solution: Verify internet access, check DV status, ensure valid OS, verify registry auth
Error: "VirtualMachine CRD not found"
Solution: Verify operator: resources_list (apiVersion="operators.coreos.com/v1alpha1", kind="CSV", namespace="openshift-cnv")
openshift-virtualization - OpenShift MCP server with KubeVirt toolset (https://github.com/openshift/openshift-mcp-server)vm_create - Create VMs (namespace, name, workload, size, storage, performance, autostart)resources_get - Get resources (apiVersion, kind, namespace, name)resources_list - List resources (apiVersion, kind, namespace optional)namespaces_list - List namespacesevents_list - List events (namespace)vm_lifecycle - VM lifecycle (namespace, name, action: start/stop/restart)resources_create_or_update - Update resources (JSON)vm-lifecycle-manager - Start VMs | vm-inventory - List VMs | vm-delete - Delete VMs | vm-clone - Clone VMs | vm-snapshot-create - Snapshot VMsIMPORTANT: This skill creates cluster resources consuming CPU, memory, storage. You MUST:
Before Creating
Never Auto-Execute
Why: Resource consumption, cost impact, namespace quotas
Rationale: Prevents unintended resource consumption; maintains user control.
workload parameter are not validated — warn the user when a custom image URL is provided and confirm the source is trusted before proceedingUser: "Create a VM"
Agent: [No params, detects namespace: production, queries SCs]
[AskUserQuestion with all 8 questions - see JSON below]
[User selects: my-app-server, production, fedora, u1, medium, 30Gi, default SC, no]
Agent: [Validates ✓, checks existence ✓, shows configuration table]
User: "yes"
Agent: [vm_create(...)]
## ✓ Virtual Machine Created Successfully
[Details, next steps, access instructions]
AskUserQuestion JSON (8 questions: VM Name, Namespace, OS, Performance, Size, Storage, StorageClass, Autostart):
{"questions": [
{"question": "VM name?", "header": "VM Name", "multiSelect": false, "options": [{"label": "Enter custom name", "description": "Lowercase, alphanumeric+hyphens, start letter, max 63"}]},
{"question": "Namespace?", "header": "Namespace", "multiSelect": false, "options": [{"label": "<current> (Current)", "description": "From kubeconfig"}, {"label": "Other", "description": "<list>"}]},
{"question": "OS?", "header": "OS", "multiSelect": false, "options": [{"label": "Fedora (Recommended)", "description": "General purpose"}, {"label": "Ubuntu", "description": "Web services"}, {"label": "RHEL", "description": "Enterprise"}, {"label": "CentOS Stream", "description": "Upstream RHEL"}, {"label": "Debian", "description": "Stable minimal"}, {"label": "OpenSUSE", "description": "Community"}]},
{"question": "Performance?", "header": "Performance", "multiSelect": false, "options": [{"label": "General (u1) (Recommended)", "description": "Balanced - most workloads"}, {"label": "Compute (c1)", "description": "CPU-intensive"}, {"label": "Memory (m1)", "description": "Memory-intensive"}, {"label": "Overcommitted (o1)", "description": "Dev/test"}]},
{"question": "Size?", "header": "Size", "multiSelect": false, "options": [{"label": "Small", "description": "1 vCPU, 2Gi"}, {"label": "Medium (Recommended)", "description": "2-4 vCPU, 4-8Gi"}, {"label": "Large", "description": "4-8 vCPU, 8-16Gi"}, {"label": "XLarge", "description": "8+ vCPU, 16+ Gi"}]},
{"question": "Storage?", "header": "Storage", "multiSelect": false, "options": [{"label": "30Gi (Recommended)", "description": "Most workloads"}, {"label": "50Gi", "description": "Moderate needs"}, {"label": "100Gi", "description": "Large requirements"}, {"label": "Custom", "description": "Specify (e.g., 75Gi)"}]},
{"question": "StorageClass?", "header": "SC", "multiSelect": false, "options": [{"label": "<default> (Default)", "description": "<perf-hint>, <migration-hint>"}, {"label": "<sc-1>", "description": "<hints>"}]},
{"question": "Autostart?", "header": "Autostart", "multiSelect": false, "options": [{"label": "No (Recommended)", "description": "Start manually"}, {"label": "Yes", "description": "Auto-start"}]}
]}
User: "Create Ubuntu VM web-01 in apps"
Agent: [Detects: web-01, apps, ubuntu; Asks: Performance, Size, Storage, SC, Autostart]
[User: u1, large, 100Gi, local-storage, yes]
Agent: [Validates, shows config]
User: "yes"
Agent: [Creates with autostart=true]
## ✓ Virtual Machine Created and Starting
User: "Deploy memory-optimized RHEL VM db-server in production"
Agent: [Detects: db-server, production, rhel, m1; Asks: Size, Storage, SC, Autostart]
[User: large, 100Gi, ceph-rbd, no]
Agent: [Shows config]
User: "Actually, compute-optimized and autostart"
Agent: [Updates: c1, yes; Shows updated]
User: "yes"
Agent: [Creates]
Custom Images: vm_create({"workload": "quay.io/containerdisks/fedora:latest", ...}) — ⚠️ When a custom image URL is provided, warn the user that image provenance is not verified and confirm the source is trusted before creating the VM
Secondary Networks: vm_create({"networks": ["vlan-network"], ...}) or {"networks": [{"name": "eth1", "networkName": "vlan"}], ...}
Explicit Instance Type: vm_create({"instancetype": "u1.large", ...})
references/README.md (opens in a new tab)references/SOURCES.md (opens in a new tab)references/troubleshooting/INDEX.md (opens in a new tab)references/troubleshooting/lifecycle-errors.md (opens in a new tab)references/troubleshooting/network-errors.md (opens in a new tab)references/troubleshooting/runtime-errors.md (opens in a new tab)references/troubleshooting/scheduling-errors.md (opens in a new tab)references/troubleshooting/storage-errors.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
inherit10 skills in this plugin
/vm-cloneClone existing virtual machines for testing, scaling, or creating templates.
Use when:
- "Clone VM [source] to [target]"
- "Create a copy of VM [name]"
- "Duplicate VM [name] for testing"
- "Create 3 copies of template-vm"
This skill clones VM configuration and optionally creates new storage or references existing storage.
NOT for snapshots (use vm-snapshot for point-in-time backups).
/vm-deletePermanently delete virtual machines and their associated resources from OpenShift Virtualization.
Use when:
- "Delete VM [name]"
- "Remove virtual machine [name]"
- "Destroy VM [name]"
- "Clean up VM [name]"
This skill handles permanent VM deletion with strict safety confirmations and typed verification.
NOT for power management (use vm-lifecycle-manager to stop VMs).
/vm-Other plugins' skills for the same job
npx claudepluginhub rhecosystemappeng/agentic-catalog --plugin rh-virt