Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Cloud Platform KVM Support

I have just created a server in GCP. It is a Ubuntu that i want to use with GNS3. The problem is that machines created in GCP does not have KVM support. Is there sone way to use it in GCP? Regards!!

like image 800
Marcelo Rodrigues Avatar asked Oct 30 '25 14:10

Marcelo Rodrigues


2 Answers

The GCP Compute Engine supports KVM virtualization module but isn't super clear about how to actually create the instance. Here is a concrete way to create a cloud instance that supports KVM.

gcloud compute instances create kvm1 \
    --zone=us-central1-a \
    --min-cpu-platform="Intel Haswell" \
    --image-project=ubuntu-os-cloud \
    --image=ubuntu-2004-focal-v20220610 \
    --boot-disk-size 200GB \
    --machine-type=n1-standard-16 \
    --enable-nested-virtualization

After creating the instance I SSHd into the machine to verify that KVM can be used:

>> ls /dev/kvm
/dev/kvm

>> egrep -c '(vmx|svm)' /proc/cpuinfo
32

>> sudo apt install cpu-checker
>> sudo kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used

This worked for my use-case of building AOSP.

like image 51
BushMinusZero Avatar answered Nov 01 '25 08:11

BushMinusZero


For now GCP Compute Engine supports KVM based nested virtualization - check docs here.

like image 23
KrzysztofZalasa Avatar answered Nov 01 '25 06:11

KrzysztofZalasa