A utility for exporting KubeVirt Virtual Machine Instance (VMI) metadata from OpenShift Virtualization clusters.
KOSME scans your OpenShift/Kubernetes cluster for KubeVirt Virtual Machine Instances and exports detailed OS information in CSV or Markdown format. It retrieves guest OS details populated by the KubeVirt guest agent, including:
- Operating System name and version
- Kernel release information
- Guest agent connectivity status
- Namespace and VM name
- Cluster-wide scanning: Queries all VMIs across all namespaces
- Guest OS info: Retrieves OS details from KubeVirt guest agent metadata
- Agent connectivity: Checks agent connection status for each VM
- Multiple export formats: Supports CSV and Markdown output
- Kubeconfig integration: Uses local kubeconfig for cluster authentication
- Python 3.x
- Kubernetes Python client library
- KubeVirt guest agent installed on VMs (for full OS metadata)
- Valid kubeconfig configured for cluster access
python kosme.py -f <format> -o <output_file>-f, --format: Export format (required)csv- Comma-separated values formatmd- Markdown table format
-o, --output: Output file path (required)- Example:
report.csvorinventory.md
- Example:
Export VMI metadata as CSV:
python kosme.py -f csv -o vmi_report.csvExport VMI metadata as Markdown:
python kosme.py -f md -o vmi_inventory.mdBuild the container image:
podman build -t kosme .Export to stdout and redirect on the host:
podman run --rm -v ~/.kube:/home/default/.kube:ro kosme -f csv -o /dev/stdout > vmi_report.csvExport to a mounted host directory:
podman run --rm \
-v ~/.kube:/home/default/.kube:ro \
-v ./output:/app/output:Z \
kosme -f csv -o output/vmi_report.csvThe exported data includes the following columns:
| Column | Description |
|---|---|
| Namespace | Kubernetes namespace where the VMI resides |
| VM_Name | Name of the Virtual Machine Instance |
| OS_Name | Guest operating system name |
| OS_Version | Guest operating system version |
| Kernel | Kernel release information |
| Agent_Connected | KubeVirt guest agent connectivity status |
- Validates kubeconfig connectivity before executing
- Handles KubeVirt API access errors gracefully
- Warns if output filename extension doesn't match the specified format
- Reports missing data as "N/A" when unavailable