MCPcopy Index your code
hub / github.com/Mirantis/virtlet

github.com/Mirantis/virtlet @v1.5.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.5.1 ↗ · + Follow
2,248 symbols 7,125 edges 283 files 981 documented · 44%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

virtlet CircleCI Maintainability Go Report Card

Virtlet is a Kubernetes runtime server which allows you to run VM workloads, based on QCOW2 images.

It is possible to run Virtlet by following the instructions from either Setting up the environment or Deploying Virtlet as a DaemonSet on kubeadm-dind-cluster documents. There's also separate document describing the process of installing Virtlet on real clusters.

See here for the description of Virtlet architecture.

Description & Documentation

See here for user-facing Virtlet description and documentation.

Community

You can join #virtlet channel on Kubernetes Slack (register at slack.k8s.io if you're not in k8s group already). Both the users and developers are welcome!

Getting started with Virtlet

To try out Virtlet follow the instructions from Setting up the environment and try out examples documents.

Virtlet introduction video

You can watch and listen to Virtlet demo video that was recorded on Kubernetes Community Meeting here.

Command line interface

Virtlet comes with a helper tool, virtletctl, that helps managing the VM pods. The binaries are available for Linux and Mac OS X in the Releases section. You can also install virtletctl as a kubectl plugin:

virtletctl install

After that you can use kubectl plugin virt instead of virtletctl (plugin subcommand will not be necessary when kubectl plugins become stable):

kubectl plugin virt ssh cirros@cirros-vm -- -i examples/vmkey

Virtlet usage demo

You can watch sample usage session under this link.

You can also give Virtlet a quick try using our demo script (requires Docker 1.12+):

wget https://raw.githubusercontent.com/Mirantis/virtlet/master/deploy/demo.sh
chmod +x demo.sh
# './demo.sh --help' displays the description
./demo.sh

The demo will start a test cluster, deploy Virtlet on it and then boot a CirrOS VM there. You may access sample nginx server via curl http://nginx.default.svc.cluster.local from inside the VM. To disconnect from VM, press Ctrl-D. After the VM has booted, you can also use virtletctl tool to connect to its SSH server:

virtletctl ssh cirros@cirros-vm -- -i examples/vmkey [command...]

By default, CNI bridge plugin is used for cluster networking. It's also possible to override this with calico, flannel or weave plugin, e.g.:

CNI_PLUGIN=flannel ./demo.sh

There's also an option to deploy Virtlet on master node of the DIND cluster, which can be handy e.g. if you don't want to use worker nodes (i.e. start the cluster with NUM_NODES=0):

VIRTLET_ON_MASTER=1 ./demo.sh

The demo script will check for KVM support on the host and will make Virtlet use KVM if it's available on Docker host. If KVM is not available, plain QEMU will be used.

The demo is based on kubeadm-dind-cluster project. Docker btrfs storage driver is currently unsupported. Please refer to kubeadm-dind-cluster documentation for more info.

You can remove the test cluster with ./dind-cluster-v1.14.sh clean when you no longer need it.

External projects using Virtlet

There are some external projects using Virtlet already. One interesting usecase is that of MIKELANGELO project that runs OSv unikernels on Kubernetes using Virtlet. Unikernels are special case of VMs that are extremely small in size (20MB or so) and can only run a single process each. Nevertheless, Virtlet has no problems handling them on Kubernetes as demonstrated in this video. Microservice Demo is available here.

Need any help with Virtlet?

If you will encounter any issue when using Virtlet please look into our issue tracker on github. If your case is not mentioned there - please fill new issue for it. In case of any questions you may also use #virtlet channel on Kubernetes Slack.

Contributing

Virtlet is an open source project and any contributions are welcomed. Look into Contributing guidelines document for our guidelines and further instructions on how to set up Virtlet development environment.

Licensing

Unless specifically noted, all parts of this project are licensed under the Apache 2.0 license.

Extension points exported contracts — how you extend this code

VirtletConfigMappingNamespaceLister (Interface)
VirtletConfigMappingNamespaceLister helps list and get VirtletConfigMappings. [6 implementers]
pkg/client/listers/virtlet.k8s/v1/virtletconfigmapping.go
Source (Interface)
Source speicifies a diagnostics information source [5 implementers]
pkg/diag/diag.go
NetTester (Interface)
(no doc) [6 implementers]
tests/network/utils_test.go
Executor (Interface)
Executor is the interface to run shell commands in arbitrary places [4 implementers]
tests/e2e/framework/common.go
Recorder (Interface)
Recorder is used to record various events for use in tests. [3 implementers]
pkg/utils/testing/rec.go
FDManager (Interface)
FDManager denotes an object that provides 'master'-side functionality of FDClient [3 implementers]
pkg/tapmanager/fdserver.go
TranslationConfig (Interface)
TranslationConfig represents a single config (prefix + rule list) in a config-set [3 implementers]
pkg/imagetranslation/interface.go
ImageManager (Interface)
ImageManager describes an image info provider. [3 implementers]
pkg/libvirttools/volumes.go

Core symbols most depended-on inside this repo

Close
called by 93
pkg/fs/fs.go
String
called by 88
pkg/tools/kubeclient.go
Rec
called by 53
pkg/utils/testing/rec.go
Name
called by 52
pkg/virt/domain_interface.go
Marshal
called by 51
tests/gm/data.go
Error
called by 50
pkg/stream/utils.go
Run
called by 40
pkg/utils/command.go
Delete
called by 39
pkg/client/clientset/versioned/typed/virtlet.k8s/v1/virtletimagemapping.go

Shape

Method 1,149
Function 751
Struct 254
Interface 65
FuncType 16
TypeAlias 13

Languages

Go100%

Modules by API surface

pkg/config/fields.go69 symbols
tests/network/utils_test.go55 symbols
pkg/manager/runtime_test.go51 symbols
pkg/image/image.go41 symbols
pkg/tools/kubeclient.go39 symbols
pkg/libvirttools/cloudinit.go38 symbols
pkg/tapmanager/fdserver.go37 symbols
pkg/virt/fake/fake_domain.go34 symbols
pkg/nettools/nettools_test.go34 symbols
pkg/libvirttools/virtualization.go32 symbols
tests/gm/data.go31 symbols
pkg/manager/runtime.go31 symbols

For agents

$ claude mcp add virtlet \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page