azureazure-virtual-machinehyper-vkvm

is it possible to run KVM on Azure


Azure Fabric runs on a customized version of Hyper-V, it appears. Is it possible to run a KVM virtualized instance on Azure (using nested virtualization)?

I have a custom VHD which is based on Debian (say). Based on this document https://learn.microsoft.com/en-us/azure/virtual-machines/linux/create-upload-generic, it seems that it might be possible, if the Hyper-V drivers are built into the kernel.

Has anyone run successfully run a KVM instance on Azure? If so, could you please share your experience.


Solution

  • This is possible, but you need to select either a Dv3 or Ev3 series VM. Also, based on my knowledge, Windows VMs are not supported, Linux VMs are supported.

    First you need to install kvm and virt-manager.

    apt-get update
    apt-get install kvm qemu-kvm libvirt-bin virtinst
    apt install virt-manager 
    adduser `id -un` libvirt
    adduser `id -un` kvm
    

    You also need to config the NIC like below: vi /etc/network/interfaces

    iface br0 inet static
        address 192.168.0.100
        network 192.168.0.0
        netmask 255.255.255.0
        broadcast 192.168.0.255
        gateway 192.168.0.1
        bridge_ports eth0
        bridge_fd 9
        bridge_hello 2
        bridge_maxage 12
        bridge_stp off
    

    Restart the NIC by using /etc/init.d/networking restart.

    Now, you could create a VM by using

    virt-install --connect qemu:///system -n vm10 -r 512 --vcpus=2 --disk path=/var/lib/libvirt/images/vm10.img,size=12 -c /dev/cdrom --vnc --noautoconsole --os-type linux --os-variant debiansqueeze --accelerate --network=bridge:br0 --hvm
    

    You could check the VM's status by using virsh -c qemu:///system list, you will get like below:

    root@shui:~# virsh -c qemu:///system list
        Id    Name                           State
    ----------------------------------------------------
        4     vm10                           running