I'm trying to enable Nested Virtualization on a existing VM instance. The VM is on the Intel Haswell CPU platform so Nested Virtualization is possible.
Now I've read this support article at Google: https://cloud.google.com/compute/docs/instances/enable-nested-virtualization-vm-instances
Under the first section Enabling nested virtualization on an instance it says the following:
Create a boot disk from a public image or from a custom image with an
operating system. Alternatively, you can skip this step and apply
the license to an existing disk from one of your VM instances.
However I can't figure out how to apply the Nested Virtualization license to an existing VM instance. The only steps described are for new disks and I want to apply it to an existing disk.
My question is: How can I enable Nested Virtualization on a existing Google Cloud Instance?
Thanks in advance,
Hugo.
I will share with you instructions on how to enable Nested Virtualization on an existing GCP VM instance. More detailed steps are described in the article you shared.
From your existing VM instance, you should already have a boot disk in your project. If not, you should create a boot disk from that VM instance.
Using the boot disk from that existing VM instance, please create a custom image with the special license key required for virtualization.
a- If you are creating an image using the gcloud command-line tool, provide the following license URL using the --licenses flag:
https://www.googleapis.com/compute/v1/projects/vm-options/global/licenses/enable-vmx
For example, the following command creates an image named nested-vm-image from an example disk named disk1:
$ gcloud compute images create nested-vm-image \
--source-disk disk1 --source-disk-zone us-central1-b \
--licenses "https://www.googleapis.com/compute/v1/projects/vm-options/global/licenses/enable-vmx"
b- If you are using the API, please include the licenses property in your API request:
POST https://www.googleapis.com/compute/v1/projects/[PROJECT_ID]/global/images
{
"licenses": ["projects/vm-options/global/licenses/enable-vmx"],
"name": "nested-vm-image",
"sourceDisk": "zones/us-central1-b/disks/disk1"
}
where [PROJECT_ID] is your project ID.
Related
I need a Compute Engine instance to import the exact configuration (IP, services, files, etc...) of the original machine, without impacting the frontend if it concerns a web server for example. While running this machine, I would be able to shut down the original machine to increase its RAM or vCPUs before starting it again and deleting the cloned instance.
The problem is that I want to automate this process, and that's why I need the gcloud command. So is there a way to clone an entire gcp instance using the gcloud command or another tool?
This is not possible with the gcloud. This is possible with the cloud console, but as you can see in this documentation:
Restrictions
You can only use this feature in the Cloud Console; this feature is not supported in the gcloud tool or the API.
What you could do is create similar (not completely equal) instances from a custom image, using that all you have to do is use the following command:
gcloud compute instances create --image=IMAGE
More details on that command can be found here
How would I go about getting CentOS 8 as a VM option in GCP/GCE? or creating my own CentOS 8 VM to run on GCP?
Any guides (README's, documents) there or contacts on how to get this done?
There is an article on GCP that talks about a technique/recipe for creating a boot image that is custom. The article is called Manually importing virtual disks. If I understand the basics of the story, you could use a technology such as VirtualBox to create a local VM image and then prepare that for import into Google Cloud Storage. From there, one could then seem to use that as a source for a new Compute Engine instance.
Currently GCP supports Centos-7 as a public image. As suggested by the previous member you can create a Custom image from source disks, images, snapshots, or images stored in Cloud Storage.
See instructions HERE
Your other option is to wait for Google to introduce Centos-8 in their supported family
Centos 8 is already available on GCE but it is without shielded VM support.
I set up centos and windows VMs in Google Cloud which has many custom installations and configuration, with 1 boot disk and 4 data disks.
I am trying to create an image of both VMs. Only options I see in google cloud to create an image from disk, snapshot, another image, cloud file or virtual disk.
Looking for some way to create an image at VM level, which I can reuse to create new VMs something similar to custom ami in AWS or custom image in Azure.
The intention is if I create VM out of that image, my new VM will come up with all 5 disks. On GCP console, when I try to create an image, it has no option of using whole VM as a source instead, I can choose single disk as source.
Is there any way or workaround to achieve this in Google Cloud?
Thanks in advance.
I found GCP Instance Templates as a solution to my problem. I can reuse Instance Templates to deploy my custom VMs.
In compute engine, How can I move an instance from project A to project B?
I have two projects, and both have the same owner.
I looked at all the interfaces inside the console, but I could not find a way.
This can be done fairly easily now, with the caveat that when you create the VM in the other project it cannot be done through the UI but rather must be done using the gcloud tool. And google even has a page to document how.
First, you need to either create an image or a snapshot of the disk used in the VM. You can do this through the Console UI or the gcloud utility. Google's documentation does a good job of explaining how to do it, but the TLDR is:
stop VM if possible, or reduce number of writes by shutting down services if not
go to Compute Engine -> Images
select create
choose the disk as source
set any other properties you need
press create
Once that has been completed, use the gcloud tool with the other project to create your new VM. To find out/verify the name of the disk image:
gcloud compute images list --project [IMAGE_PROJECT]
then create the vm (add any additional options you need):
gcloud compute instances create [INSTANCE_NAME] --image [IMAGE_NAME] --image-project [IMAGE_PROJECT]
There isn't any tool in GCP that allows migrating one Compute Engine instance from one project to another.
However, it is still possible to recreate one instance from one project to another, by creating a snapshot of the disk, creating a custom image, and create a new VM from it in the second project.
This article gives a nice step by step guide on how to do it.
There is a newer doc page to copy VM between projects
The answers i found lead me towards using perl api for VMware orchestration.
or VirtuallyGhetto
but cannot find puppet samples, where a user can get permissions to create a VM SnapShot, and also revert it, without having root access, or admin rights.
I also found vmth but VMTH currently only works in a QEMU+KVM environment
You need to create a Exec resource and map it to the VMWare Api that allows you to create a VM Snapshot.
Note: Creating Snapshots are not usable anymore since you can create new VMs everytime.