Skip to content

rtacconi/kcore-go

Repository files navigation

kcore

A modern, minimal virtualization platform for datacenters and home labs.

Quick Start

  1. Download the latest ISO and kctl from Releases
  2. Write the ISO to a USB stick and boot your machine from it
  3. From your laptop, install kcore to disk remotely:
kctl --insecure node disks --node <node-ip>:9091
kctl --insecure node install \
  --node <node-ip>:9091 \
  --os-disk /dev/sda \
  --data-disk /dev/nvme0n1
  1. After reboot, create VMs:
kctl create vm web-server --cpu 4 --memory 8G
kctl get vms

See the Quick Start Guide for a full walkthrough.


Documentation

Getting Started

User Guides

Development


What is kcore?

kcore is a clustered KVM virtualization platform that provides:

  • Simple VM Management - Create, manage, and delete VMs via API
  • Automated Deployment - Boot from USB, run one command, reboot
  • Controller + Agent Architecture - Controller orchestrates runtime + automator workflows across nodes
  • Modern Stack - Go + gRPC + NixOS + KVM/libvirt
  • Network Fabric - EVPN + VXLAN overlays for multi-node networking

Key Components

  • Controller - Deployed on a node, manages cluster state and scheduling
  • Node Agent Runtime API - Runs on each compute node, manages local VMs/storage
  • Node Agent Automator API - Handles host bootstrap operations (apply Nix, install workflows)
  • kcore ISO - Bootable installer with everything included

Development

Prerequisites

  • Nix with flakes enabled
  • Go 1.22+
  • Make

Setup

# Clone repository
git clone https://github.com/rtacconi/kcore.git
cd kcore

# Enter Nix dev shell
nix develop

# Generate protobuf code
make proto

# Build components
make controller
make node-agent-nix
make build-iso

Available Commands

make help                           # Show all commands
make proto                          # Generate protobuf code
make controller                     # Build controller
make kctl                           # Build kctl CLI
make node-agent-nix                 # Build node-agent
make build-iso                      # Build kcore ISO
NODE_IP=x.x.x.x make create-vm     # Create VM
NODE_IP=x.x.x.x make test-node     # Test node

See Commands Reference for full list.


Architecture

┌─────────────────────┐
│   Controller        │  desired state, scheduling, reconciliation
│   (port 9090)       │
└──────────┬──────────┘
           │ gRPC (mTLS)
    ┌──────┴─────────────────────┐
    │                            │
┌───▼───────────────────┐  ┌─────▼───────────────────┐
│ Node Agent Runtime API│  │ Node Agent Automator API│
│ (VM/storage operations)│ │ (bootstrap/install ops)  │
└───────────────────────┘  └─────────────────────────┘
           ▲                            ▲
           └──── state + system info ───┘

Controller <── CRDT state exchange (next phase) ──> Controller
  • Controller receives desired-state requests and coordinates runtime + automator workflows
  • Node Agent Runtime API manages local VMs via libvirtd
  • Node Agent Automator API manages host-level provisioning and install operations
  • Networking uses EVPN + VXLAN overlays
  • Communication uses gRPC with mutual TLS authentication

See Architecture for detailed design and deployment model.


Features

Fully Automated

  • Boot from USB → Install remotely via Automator API → Auto-reboot
  • All services start automatically
  • Node auto-registers with controller

Hardware Auto-Detection

  • DHCP on all interfaces
  • Works with any NIC
  • No manual configuration

Production Ready

  • libvirtd + virtlogd managed by systemd
  • Automatic service restarts
  • Comprehensive logging

Developer Friendly

  • Make-based build system
  • Nix flake dev environment
  • Scripts in separate files (not inline)

Common Tasks

Build and Deploy

# Build ISO
make build-iso

# Write to USB
USB_DEVICE=/dev/disk4 make write-usb

# Boot node from USB, then install remotely via Automator API:
kctl --insecure node disks --node <node-ip>:9091
kctl --insecure node install \
  --node <node-ip>:9091 \
  --os-disk /dev/sda \
  --data-disk /dev/nvme0n1 \
  --join-controller <controller-ip>

VM Management

# Create VM
kctl create vm web-server --cpu 4 --memory 8G --disk 100G

# List VMs
kctl get vms

# Get VM details
kctl describe vm web-server

# Delete VM
kctl delete vm web-server

Update Node

# Rebuild node-agent
make node-agent-nix

# Deploy to node
NODE_IP=192.168.40.146 make deploy-node

# Restart service
ssh root@192.168.40.146 systemctl restart kcore-node-agent

Project Structure

kcore/
├── cmd/
│   ├── controller/      # Controller binary
│   └── node-agent/      # Node agent binary
├── pkg/
│   ├── config/          # Configuration parsing
│   ├── controller/      # Controller logic
│   └── sqlite/          # Database
├── node/
│   ├── libvirt/         # Libvirt integration
│   ├── storage/         # Storage drivers
│   └── server.go        # gRPC server
├── api/                 # Generated protobuf code
├── proto/               # Protobuf definitions
├── modules/             # NixOS modules
├── scripts/             # Automation scripts
├── docs/                # Documentation
└── examples/            # Example configs

See Project Structure for details.


Contributing

Contributions welcome! Please:

  1. Read the documentation in docs/
  2. Use Conventional Commits for commit messages
  3. Test changes on both macOS and Linux where applicable

License

[Add your license here]


Links


Support

For help:

About

kcore virtualization platform

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors