Soru

Zorluk: KolayDeploying and Managing Compute Engine Virtual Machines

You are managing Compute Engine resources and need to create a custom image from an existing virtual machine's boot disk and use it to deploy a new virtual machine instance. What is the correct sequence of steps to safely perform this operation?

  1. 1Stop the running source virtual machine instance to ensure file system consistency.
  2. 2Create a custom image specifying the source boot disk of the stopped instance using `gcloud compute images create`.
  3. 3Deploy a new virtual machine instance specifying the custom image as the boot disk with `gcloud compute instances create`.
  4. 4Start the original source virtual machine instance to restore its normal operations.

Cevap

The correct order of operations is: Stop the running source instance -> Create the custom image from the boot disk -> Deploy the new instance using the custom image -> Restart the source instance.
To create a consistent custom image from a Compute Engine boot disk, the source virtual machine should first be stopped. After the VM stops, the image is created from its boot disk. The new VM instance is then provisioned from the created custom image, and finally the original source VM is restarted.

Adım Adım Çözüm

1
Stop the source VM instance.
The source instance enters the TERMINATED state, locking disk modifications.
Creating an image from an active disk can cause data corruption or inconsistent snapshot states.
2
Execute `gcloud compute images create`.
A new reusable custom image is created from the source boot disk.
The custom image encapsulates the OS configuration and applications for future deployments.
3
Execute `gcloud compute instances create` with `--image` pointing to the custom image.
A new Compute Engine VM instance is created with identical configuration and disk content.
New VM instances require an image source for provisioning their boot disks.
4
Start the source VM instance using `gcloud compute instances start`.
The original VM resumes normal operation.
Once image creation completes, the original instance can safely resume serving traffic.

Anahtar Kavram

Custom Image Creation and VM Provisioning Workflow
Bu soruyu puanla