is it possible to run KVM on Azure

2019-02-15 04:28发布

问题:

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://docs.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.

回答1:

This is possible, but you need select Dv3 and Ev3 series VM. Also, based on my knowledge, Windows VM is also not supported, Linux VM is supported.

You need install kvm and virt-manager firstly.

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 config 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 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