I have to been trying to follow steps mentioned in this https://cloud.google.com/marketplace/docs/partners/vm/build-vm-image#create_a_licensed_vm_image guide to offer VM solution on google cloud marketplace.
With reference to step number 5 in the above link:-
The data disk shows up on my system with its boot and a data partition, but it is not mounted anywhere. I am able to access my installed application files on my current boot disk, which is weird since I did not install my application on this boot disk.
Here is my gcloud command for first instance.
gcloud compute instances create vm \
--image-family centos-7 \
--image-project centos-cloud \
--no-restart-on-failure \
--maintenance-policy=TERMINATE --preemptible
Here is my gcloud command for second instance.
gcloud compute instances create vm2 \
--image-family centos-7 \
--image-project centos-cloud \
--no-restart-on-failure \
--maintenance-policy=TERMINATE --preemptible \
--disk=name=vm,mode=rw,boot=no
Could someone please explain me step number 5 regarding boot disk cleanup in the link I mentioned above.
I figured it out. It seems that even though I am attaching the previous boot disk as data disk, the 2nd instance boots up with the previous boot disk (this behavior is random). lsblk outputs two identical boot disks. Now if i find my application running, then it means that I booted from the first boot disk otherwise the second. The only workaround I found for this issue is to spawn the 2nd instance first, wait for it to completely boot and then attach the previous boot disk as data disk.
Related
I have a Managed Instance Group of Google Compute Engine VMs (based on a template with container deployment on Container-Optimized OS). The MIG is regional (multi-zoned).
I can release an updated container image (docker run, docker tag, docker push), and then I'd like to restart all VMs in the MIG one by one, so that they can have the updated container (not sure if there's a simpler/better alternative to refresh the VMs attached container). But I also want to introduce a slight delay (say 60 seconds) between each VM's restart event, so that only one or two VMs are unavailable during their restart.
What are some ways to do this programmatically (either via gcloud CLI or their API)?
I tried a rolling restart of the MIG, with maximum unavailable and minimum wait time flags set:
gcloud beta compute instance-groups managed rolling-action restart MIG_NAME \
--project="..." --region="..." \
--max-unavailable=1 --min-ready=60
... but it returns an error:
ERROR: (gcloud.beta.compute.instance-groups.managed.rolling-action.restart) Could not fetch resource:
- Invalid value for field 'resource.updatePolicy.maxUnavailable.fixed': '1'. Fixed updatePolicy.maxUnavailable for regional managed instance group has to be either 0 or at least equal to the number of zones.
Is there a way to perform one-by-one instance restarts with a slight delay in between each action?
Unfortunately the MIGs don't handle this use-case for regional deployments as at Jan 2023. You can, however, orchestrate the rolling update yourself along (sudo code):
for (INSTANCE in instances)
// Force restart the instance
gcloud compute instance-groups managed update-instances MIG_NAME \
--project="..." --region="..." \
--instances=INSTANCE --minimal-action=RESTART \
--most-disruptive-allowed-action=RESTART
WAIT
if (container on INSTANCE not working correctly)
// Break and alert the operator
I cannot restore a snapshot of an instance with Windows Server 2019.
When restoring the snapshot generated with the machine turned on, I get a machine that does not start and always has a blue screen as a return.
When restoring a snapshot generated with the machine turned off, everything works normally, the restored machine boots normally.
Serial Port = inaccessible_boot_device 0xffff google cloud platform
There is a restriction in VSS enabled snapshot.
When a VSS snapshot is taken, Windows marks the volume as read-only.
The read-only flag must be cleared if a user want to create an instance from it.
To work around this, remove the read-only flag from any new disk that you create from a VSS snapshot.
Alternatively, you can create a new disk/compute instance using gcloud beta compute instances create --erase-windows-vss-signature
gcloud compute instances create instance-3 \
--source-snapshot=snapshot-1 \
--boot-disk-size=50 \
--boot-disk-type=pd-standard \
--boot-disk-device-name=instancedisk-3 \
--erase-windows-vss-signature
I have created a VM with GPU and have been using it since then.
is it possible to make this VM preemptable by changing it configuration now?
In Edit config, I see preemptability as Off, but it is grayed out and not letting me change it.
Any suggestions?
According to the google documentation, these are the properties you can change after creating a VM. As you'll notice, you can not change the preemptive property of an instance.
However, a possibility would be to snapshot your current disk
gcloud compute disks snapshot DISK_NAME \
--snapshot-names=SNAPSHOT_NAME
--storage-location STORAGE_LOCATION
And spin up a new instance using the snapshot of the former
gcloud compute instances create VM_NAME \
--source-snapshot=BOOT_SNAPSHOT_NAME \
--boot-disk-size=BOOT_DISK_SIZE \
--boot-disk-type=BOOT_DISK_TYPE \
--boot-disk-device-name=BOOT_DISK_NAME
Full GCP Documentation:
https://cloud.google.com/compute/docs/disks/create-snapshots
https://cloud.google.com/compute/docs/instances/create-start-instance#restore_boot_snapshot
I'm unable to start a new VM Instance with a Nvidia Tesla K80 GPU.
Whenever I try to start, i get the following error message:
Start VM instance "gpu-1"
My First Project
The zone 'projects/XXX/zones/europe-west1-b' does not have enough resources
available to fulfill the request. Try a different zone, or try again
later.
I've tried nearly all zones around the world, that have Nvidia Tesla K80 GPUs. I've also tried different hours of the day.
Is it correct, that the rather cheap GPUs are most of the time heavily overbooked all around the world or is it a misleading error message I am receiving? Or is some maintenance going on, I did not notice?
GPUs are resources that are not available in all the zones, you can see the GPUs availables per zone in the following link.
Also, they are a high demanded resources, for this reason sometimes is difficult to create an instance using GPUs,
I tried in my own project and I received the same problem in some zones, but at the end, I was able to create an instance with nvidia-tesla-k80 using the following command
gcloud compute instances create test-instance \
--zone=us-west1-b \
--machine-type=n1-standard-1 \
--image-project=eip-images \
--maintenance-policy=TERMINATE \
--accelerator=type=nvidia-tesla-k80,count=1 \
--image=debian-9-drawfork-v20200207 \
--boot-disk-size=50GB \
--boot-disk-type=pd-standard\
And I received the following output:
Created [https://www.googleapis.com/compute/v1/projects/projectname/zones/us-west1-b/instances/test-instance].
NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS
test-instance us-west1-b n1-standard-1 10.x.x.x 34.x.x.x RUNNING
I hope you find this information useful.
Is it possible to create a google cloud datalab with f1-micro and 20GB of boot disk and 10GB of persistent disk?
Or is the minimum requirement, the default of n1-standard-1 and 200GB Standard Persistent Disk?
I tried to create a datalab instance with the following command:
datalab create --image-name practice --disk-size-gb 10 --idle-timeout "30m" --machine-type f1-micro practice
Although the VM is created, the datalab gets stuck at waiting for datalab to be available at localhost.
It works when I go with the default command of
datalab create practice
Any clarifications on this?
Don't include the "--image-name practice" arg. image-name is the Docker image to run on the VM, and needs to be either the Datalab provided one or a custom image you've created based off of that one.
This command should work: datalab create --disk-size-gb 10 --idle-timeout "30m" --machine-type f1-micro practice though you should note that this machine will be too small to run even some of the sample notebooks, and it's reduced size will cause a longer startup time.
I just tried it and startup was ~10 minutes.