Google compute engine 如何让嵌套虚拟化在e2 micro GCP VM上工作?
我正试图利用谷歌云平台(GCP)上的嵌套虚拟化功能,但在尝试使用它时失败了。以下是我遵循的程序,根据:Google compute engine 如何让嵌套虚拟化在e2 micro GCP VM上工作?,google-compute-engine,Google Compute Engine,我正试图利用谷歌云平台(GCP)上的嵌套虚拟化功能,但在尝试使用它时失败了。以下是我遵循的程序,根据: 基于Ubuntu18LTS映像创建一个新磁盘 应用vmx许可证从磁盘创建新映像 从映像创建新的VM实例 使用Ubuntu中的cpu checker包检查是否支持嵌套虚拟化 运行sudo kvm ok命令时,我收到以下消息: 信息:您的CPU不支持KVM扩展 不能使用KVM加速 故障排除 确保我使用的是Haswell CPU 我使用gcloud compute instances descrip
cpu checker
包检查是否支持嵌套虚拟化sudo kvm ok
命令时,我收到以下消息:
信息:您的CPU不支持KVM扩展
不能使用KVM加速
故障排除
确保我使用的是Haswell CPU
我使用gcloud compute instances description
命令确认我的e2 micro
VM使用的是英特尔Haswell CPU,根据GCP文档,这是嵌套虚拟化工作所需的最低要求
(base) ➜ ~ gcloud compute instances describe firecracker
No zone specified. Using zone [us-central1-a] for instance: [firecracker].
canIpForward: false
cpuPlatform: Intel Haswell
creationTimestamp: 'xxxxxxxxxxxxxxx'
deletionProtection: false
description: firecracker
disks:
- autoDelete: true
boot: true
deviceName: persistent-disk-0
guestOsFeatures:
- type: VIRTIO_SCSI_MULTIQUEUE
index: 0
interface: SCSI
kind: compute#attachedDisk
licenses:
- https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/licenses/ubuntu-1804-lts
- https://www.googleapis.com/compute/v1/projects/vm-options/global/licenses/enable-vmx
mode: READ_WRITE
source: https://www.googleapis.com/compute/v1/projects/xxxxxxxx/zones/us-central1-a/disks/firecracker
type: PERSISTENT
id: 'xxxxxxxxxxxxxxxxxxxxx'
kind: compute#instance
labelFingerprint: xxxxxxxxxxxxxx
machineType: https://www.googleapis.com/compute/v1/projects/xxxxxxxx/zones/us-central1-a/machineTypes/e2-micro
metadata:
fingerprint: xxxxxxxxxxxxxxx
kind: compute#metadata
name: firecracker
networkInterfaces:
- accessConfigs:
- kind: compute#accessConfig
name: external-nat
natIP: xxxxxxxxxxx
networkTier: PREMIUM
type: ONE_TO_ONE_NAT
fingerprint: xxxxxxxxxxxxxx
kind: compute#networkInterface
name: nic0
network: https://www.googleapis.com/compute/v1/projects/xxxxxxxx/global/networks/default
networkIP: xxxxxxxxxxxxxx
subnetwork: https://www.googleapis.com/compute/v1/projects/xxxxxxxx/regions/us-central1/subnetworks/default
scheduling:
automaticRestart: false
onHostMaintenance: TERMINATE
preemptible: true
selfLink: https://www.googleapis.com/compute/v1/projects/xxxxxxxx/zones/us-central1-a/instances/firecracker
serviceAccounts:
- email: xxxxxxxx@developer.gserviceaccount.com
scopes:
- https://www.googleapis.com/auth/devstorage.read_only
- https://www.googleapis.com/auth/logging.write
- https://www.googleapis.com/auth/monitoring.write
- https://www.googleapis.com/auth/pubsub
- https://www.googleapis.com/auth/service.management.readonly
- https://www.googleapis.com/auth/servicecontrol
- https://www.googleapis.com/auth/trace.append
startRestricted: false
status: RUNNING
tags:
fingerprint: xxxxxxxxxxxxxxxx
zone: https://www.googleapis.com/compute/v1/projects/xxxxxxxx/zones/us-central1-a
尝试了Ubuntu 16.04 LTS
根据文档,我还尝试了使用Ubuntu 16.04 LTS的相同过程,得到了与Ubuntu 18.04 LTS相同的结果
问题
问题:如何成功启动支持嵌套虚拟化的GCP虚拟机?据我所知,我遵循了文档的要求,但无法使其正常工作
我意识到文档并没有明确指出他们使用Ubuntu18LTS测试嵌套虚拟化,但这并不一定意味着它不起作用。这是一个猜测答案。。。如果错误,发表评论,它将被删除 如果我们在下面查看,我们会发现以下内容: 共享核心机类型在N1和E2系列中可用。 这些机器类型分时共享一个物理核心。这可能是一个错误 运行小型、非资源密集型系统的经济高效方法 应用程序
- N1:f1 micro和g1小型共享核心机器类型最多有1个vCPU可用于短时间爆破
- E2:E2 micro、E2 small和E2 medium共享核心机型有2个VCPU可用于短时间爆破
在你的故事中,你说你使用的是e2微型机器类型。我们看到您选择的机器类型似乎执行共享核心处理,并试图启用嵌套虚拟化。我的直觉是,共享核心意味着运行操作系统/应用程序的CPU在运行其操作系统/应用程序的其他用户之间被时间分割。。。而嵌套虚拟化的概念(我认为)要求您拥有CPU的独占所有权,就像“普通”家庭成员一样。我建议您使用n1-standard-2机器类型运行您的配方,看看您应用的相同配方是否有效。如果是的话。。。然后我们可能会得出一个初步结论,即使用共享核心处理器的micro/small可能不支持嵌套虚拟化。。。如果错误,发表评论,它将被删除 如果我们在下面查看,我们会发现以下内容: 共享核心机类型在N1和E2系列中可用。 这些机器类型分时共享一个物理核心。这可能是一个错误 运行小型、非资源密集型系统的经济高效方法 应用程序
- N1:f1 micro和g1小型共享核心机器类型最多有1个vCPU可用于短时间爆破
- E2:E2 micro、E2 small和E2 medium共享核心机型有2个VCPU可用于短时间爆破
在你的故事中,你说你使用的是e2微型机器类型。我们看到您选择的机器类型似乎执行共享核心处理,并试图启用嵌套虚拟化。我的直觉是,共享核心意味着运行操作系统/应用程序的CPU在运行其操作系统/应用程序的其他用户之间被时间分割。。。而嵌套虚拟化的概念(我认为)要求您拥有CPU的独占所有权,就像“普通”家庭成员一样。我建议您使用n1-standard-2机器类型运行您的配方,看看您应用的相同配方是否有效。如果是的话。。。然后我们可能会得出一个初步结论,即使用共享核心处理器的micro/small可能不支持嵌套虚拟化。我尝试了与您相同的命令,但使用了Ubuntu 16.04和18.04 LTS,我的虚拟机一开始也不支持KVM 我决定检查并重试:
gcloud计算磁盘创建disk1——映像项目ubuntu操作系统云\
--图像系列ubuntu-1804-lts——zone us-central1-a
gcloud计算映像创建嵌套的vm映像\
--源磁盘disk1—源磁盘区域us-central1-a\
--许可证”https://compute.googleapis.com/compute/v1/projects/vm-options/global/licenses/enable-vmx“
gcloud计算实例创建示例嵌套vm--zone us-central1-b\
--最小cpu平台“英特尔Haswell”\
--映像嵌套vm映像
$grep-cw vmx/proc/cpuinfo
1.
$sudo kvm正常
信息:/dev/kvm存在
可以使用KVM加速
它还适用于可抢占虚拟机:
gcloud计算实例创建可抢占的嵌套vm\
--us-central1-a区——可抢占\
--最小cpu平台“英特尔Haswell”\
--映像嵌套vm映像
我试图在步骤3设置另一种机器类型,但出现错误:
gcloud计算实例创建e2嵌套vm——区域us-central1-a\
--机器类型e2-standard-2\
--最小cpu平台“英特尔Haswell”\
--映像嵌套vm映像
错误:(gcloud.compu)
(base) ➜ ~ gcloud compute instances describe firecracker
No zone specified. Using zone [us-central1-a] for instance: [firecracker].
canIpForward: false
cpuPlatform: Intel Haswell
creationTimestamp: 'xxxxxxxxxxxxxxx'
deletionProtection: false
description: firecracker
disks:
- autoDelete: true
boot: true
deviceName: persistent-disk-0
guestOsFeatures:
- type: VIRTIO_SCSI_MULTIQUEUE
index: 0
interface: SCSI
kind: compute#attachedDisk
licenses:
- https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/licenses/ubuntu-1804-lts
- https://www.googleapis.com/compute/v1/projects/vm-options/global/licenses/enable-vmx
mode: READ_WRITE
source: https://www.googleapis.com/compute/v1/projects/xxxxxxxx/zones/us-central1-a/disks/firecracker
type: PERSISTENT
id: 'xxxxxxxxxxxxxxxxxxxxx'
kind: compute#instance
labelFingerprint: xxxxxxxxxxxxxx
machineType: https://www.googleapis.com/compute/v1/projects/xxxxxxxx/zones/us-central1-a/machineTypes/e2-micro
metadata:
fingerprint: xxxxxxxxxxxxxxx
kind: compute#metadata
name: firecracker
networkInterfaces:
- accessConfigs:
- kind: compute#accessConfig
name: external-nat
natIP: xxxxxxxxxxx
networkTier: PREMIUM
type: ONE_TO_ONE_NAT
fingerprint: xxxxxxxxxxxxxx
kind: compute#networkInterface
name: nic0
network: https://www.googleapis.com/compute/v1/projects/xxxxxxxx/global/networks/default
networkIP: xxxxxxxxxxxxxx
subnetwork: https://www.googleapis.com/compute/v1/projects/xxxxxxxx/regions/us-central1/subnetworks/default
scheduling:
automaticRestart: false
onHostMaintenance: TERMINATE
preemptible: true
selfLink: https://www.googleapis.com/compute/v1/projects/xxxxxxxx/zones/us-central1-a/instances/firecracker
serviceAccounts:
- email: xxxxxxxx@developer.gserviceaccount.com
scopes:
- https://www.googleapis.com/auth/devstorage.read_only
- https://www.googleapis.com/auth/logging.write
- https://www.googleapis.com/auth/monitoring.write
- https://www.googleapis.com/auth/pubsub
- https://www.googleapis.com/auth/service.management.readonly
- https://www.googleapis.com/auth/servicecontrol
- https://www.googleapis.com/auth/trace.append
startRestricted: false
status: RUNNING
tags:
fingerprint: xxxxxxxxxxxxxxxx
zone: https://www.googleapis.com/compute/v1/projects/xxxxxxxx/zones/us-central1-a