About nested VMs when building a KVM environment inside a VM built in an Azure environment

千葉涼音 20 Reputation points
2024-10-03T12:21:36.1633333+00:00

Hi Team,

I am writing this in English using Google Translate, so it may be difficult to read, but I hope you will bear with me.

I am planning to set up Ubuntu Server 24 in an Azure environment and create a nested VM using Linux KVM, but I could not find any official page on setting up a nested VM using Linux KVM in Azure.

Is it possible to build a nested VM using KVM in Azure?

Also, please let me know if there are any blog pages or similar with the above configuration.

Best Regards,

Rion Chiba

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,988 questions
{count} votes

Accepted answer
  1. Jackson Martins 10,556 Reputation points MVP
    2024-10-03T12:47:21.66+00:00

    Hi

    despite not having tested it and not officially supported, it is possible to build a nested VM using Linux KVM in Azure, but there are certain requirements and limitations.
    Select a supported VM size for nested virtualization:
    https://learn.microsoft.com/en-us/answers/questions/818320/virtual-machine-that-supports-nested-virtualisatio

    You need to enable nested virtualization explicitly on the Azure VM. For a Linux-based VM like Ubuntu, this involves enabling the KVM module and configuring the system accordingly.
    SSH into your Azure VM and check if virtualization is supported

    grep -E 'vmx|svm' /proc/cpuinfo
    

    References: https://learn.microsoft.com/en-us/answers/questions/1405242/how-to-enable-nested-virtualization-on-d4s-v3

    Install KVM:

    sudo apt update
    sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virt-manager
    

    other reference: https://brianlinkletter.com/2018/06/create-a-nested-virtual-machine-in-a-microsoft-azure-linux-vm/
    Get in touch if you need more help with this issue.

    --please don't forget to "[Accept the answer]" if the reply is helpful--

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.