k8s-kubevirt

Virtual machine management with KubeVirt on Kubernetes. Use when creating, managing, or troubleshooting VMs running on Kubernetes clusters.

859 stars

Best use case

k8s-kubevirt is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Virtual machine management with KubeVirt on Kubernetes. Use when creating, managing, or troubleshooting VMs running on Kubernetes clusters.

Teams using k8s-kubevirt should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/k8s-kubevirt/SKILL.md --create-dirs "https://raw.githubusercontent.com/rohitg00/kubectl-mcp-server/main/kubernetes-skills/claude/k8s-kubevirt/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/k8s-kubevirt/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How k8s-kubevirt Compares

Feature / Agentk8s-kubevirtStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Virtual machine management with KubeVirt on Kubernetes. Use when creating, managing, or troubleshooting VMs running on Kubernetes clusters.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# KubeVirt VM Management

Manage virtual machines on Kubernetes using kubectl-mcp-server's KubeVirt tools (13 tools).

## When to Apply

Use this skill when:
- User mentions: "KubeVirt", "virtual machine", "VM", "VirtualMachineInstance", "VMI"
- Operations: starting/stopping VMs, live migration, managing VM lifecycle
- Keywords: "VM on Kubernetes", "virtualization", "data volume", "instance type"

## Priority Rules

| Priority | Rule | Impact | Tools |
|----------|------|--------|-------|
| 1 | Detect KubeVirt installation first | CRITICAL | `kubevirt_detect_tool` |
| 2 | Check VM status before operations | HIGH | `kubevirt_vm_get_tool` |
| 3 | List VMIs for running VMs | HIGH | `kubevirt_vmis_list_tool` |
| 4 | Use instance types for consistency | MEDIUM | `kubevirt_instancetypes_list_tool` |

## Quick Reference

| Task | Tool | Example |
|------|------|---------|
| Detect KubeVirt | `kubevirt_detect_tool` | `kubevirt_detect_tool()` |
| List VMs | `kubevirt_vms_list_tool` | `kubevirt_vms_list_tool(namespace)` |
| Start VM | `kubevirt_vm_start_tool` | `kubevirt_vm_start_tool(name, namespace)` |
| Live migrate VM | `kubevirt_vm_migrate_tool` | `kubevirt_vm_migrate_tool(name, namespace)` |

## Check Installation

```python
kubevirt_detect_tool()
```

## List VMs

```python
# List VirtualMachines
kubevirt_vms_list_tool(namespace="default")

# List VirtualMachineInstances (running VMs)
kubevirt_vmis_list_tool(namespace="default")
```

## Get VM Details

```python
# Get VM definition
kubevirt_vm_get_tool(name="my-vm", namespace="default")

# Shows:
# - Spec (CPU, memory, disks)
# - Running status
# - Conditions
```

## VM Lifecycle

### Start VM

```python
kubevirt_vm_start_tool(name="my-vm", namespace="default")
```

### Stop VM

```python
kubevirt_vm_stop_tool(name="my-vm", namespace="default")
```

### Restart VM

```python
kubevirt_vm_restart_tool(name="my-vm", namespace="default")
```

### Pause/Unpause VM

```python
# Pause (freeze CPU)
kubevirt_vm_pause_tool(name="my-vm", namespace="default")

# Unpause
kubevirt_vm_unpause_tool(name="my-vm", namespace="default")
```

## Live Migration

```python
# Migrate VM to another node
kubevirt_vm_migrate_tool(name="my-vm", namespace="default")

# Check migration status
kubevirt_vmis_list_tool(namespace="default")
# Look for: migrationState
```

## Instance Types

```python
# List available instance types
kubevirt_instancetypes_list_tool()

# Instance types define:
# - CPU count
# - Memory size
# - GPU allocation
```

## Data Volumes

```python
# List data volumes (persistent VM disks)
kubevirt_datavolumes_list_tool(namespace="default")

# List data sources (golden images)
kubevirt_datasources_list_tool(namespace="default")
```

## Create VM

```python
kubectl_apply(manifest="""
apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
  name: my-vm
  namespace: default
spec:
  running: true
  template:
    metadata:
      labels:
        kubevirt.io/vm: my-vm
    spec:
      domain:
        cpu:
          cores: 2
        memory:
          guest: 4Gi
        devices:
          disks:
          - name: rootdisk
            disk:
              bus: virtio
          - name: cloudinitdisk
            disk:
              bus: virtio
      volumes:
      - name: rootdisk
        containerDisk:
          image: quay.io/kubevirt/fedora-cloud-container-disk-demo
      - name: cloudinitdisk
        cloudInitNoCloud:
          userData: |
            #cloud-config
            password: fedora
            chpasswd: { expire: False }
""")
```

## Create VM with DataVolume

```python
kubectl_apply(manifest="""
apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
  name: vm-with-pvc
  namespace: default
spec:
  running: true
  dataVolumeTemplates:
  - metadata:
      name: vm-with-pvc-disk
    spec:
      source:
        http:
          url: https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2
      storage:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 10Gi
  template:
    spec:
      domain:
        cpu:
          cores: 2
        memory:
          guest: 4Gi
        devices:
          disks:
          - name: rootdisk
            disk:
              bus: virtio
      volumes:
      - name: rootdisk
        dataVolume:
          name: vm-with-pvc-disk
""")
```

## Troubleshooting

### VM Not Starting

```python
1. kubevirt_vm_get_tool(name, namespace)  # Check status/conditions
2. kubevirt_vmis_list_tool(namespace)  # Check VMI exists
3. get_events(namespace)  # Check events
4. get_pods(namespace, label_selector="kubevirt.io/vm=<name>")  # Check virt-launcher
```

### Migration Failed

```python
1. kubevirt_vmis_list_tool(namespace)  # Check migrationState
2. get_events(namespace)  # Check events
3. # Common issues:
   # - No suitable target node
   # - Insufficient resources
   # - Shared storage required
```

## Related Skills

- [k8s-storage](../k8s-storage/SKILL.md) - Persistent storage
- [k8s-operations](../k8s-operations/SKILL.md) - kubectl operations

Related Skills

k8s-vind

859
from rohitg00/kubectl-mcp-server

Manage vCluster (virtual Kubernetes clusters) instances using vind. Use when creating, managing, or operating lightweight virtual clusters for development, testing, or multi-tenancy.

k8s-troubleshoot

859
from rohitg00/kubectl-mcp-server

Debug Kubernetes pods, nodes, and workloads. Use when pods are failing, containers crash, nodes are unhealthy, or users mention debugging, troubleshooting, or diagnosing Kubernetes issues.

k8s-storage

859
from rohitg00/kubectl-mcp-server

Kubernetes storage management for PVCs, storage classes, and persistent volumes. Use when provisioning storage, managing volumes, or troubleshooting storage issues.

k8s-service-mesh

859
from rohitg00/kubectl-mcp-server

Manage Istio service mesh for traffic management, security, and observability. Use for traffic shifting, canary releases, mTLS, and service mesh troubleshooting.

k8s-security

859
from rohitg00/kubectl-mcp-server

Audit Kubernetes RBAC, enforce policies, and manage secrets. Use for security reviews, permission audits, policy enforcement with Kyverno/Gatekeeper, and secret management.

k8s-rollouts

859
from rohitg00/kubectl-mcp-server

Progressive delivery with Argo Rollouts and Flagger. Use when implementing canary deployments, blue-green deployments, or traffic shifting strategies.

k8s-policy

859
from rohitg00/kubectl-mcp-server

Kubernetes policy management with Kyverno and Gatekeeper. Use when enforcing security policies, validating resources, or auditing policy compliance.

k8s-operations

859
from rohitg00/kubectl-mcp-server

kubectl operations for applying, patching, deleting, and executing commands on Kubernetes resources. Use when modifying resources, running commands in pods, or managing resource lifecycle.

k8s-networking

859
from rohitg00/kubectl-mcp-server

Kubernetes networking management for services, ingresses, endpoints, and network policies. Use when configuring connectivity, load balancing, or network isolation.

k8s-multicluster

859
from rohitg00/kubectl-mcp-server

Manage multiple Kubernetes clusters, switch contexts, and perform cross-cluster operations. Use when working with multiple clusters, comparing environments, or managing cluster lifecycle.

k8s-kind

859
from rohitg00/kubectl-mcp-server

Manage kind (Kubernetes IN Docker) local clusters. Use when creating, testing, or developing with local Kubernetes clusters in Docker containers.

k8s-incident

859
from rohitg00/kubectl-mcp-server

Respond to Kubernetes incidents with runbooks and diagnostics. Use for outages, pod failures, node issues, network problems, and emergency response.