简体   繁体   中英

Google Cloud: can't add disk to instance template with write permission

I am running preemptable instance on Google Cloud. To keep it up, I am using instance group that spawns this instance from an instance template once it gets killed. I want to run Mongo on this instance (I understand that it is a bad idea, it is good enough for me) so I need to add a persistent disk to the instance.

When I add a disk to the instance template, the mode radio button is greyed out and set on read-only . There is a warning stating that I can change mode only when manually spawn an instance from a template. It does not help me since I need the instance group to automatically spawn the new instances with a writable disk. How can I do it?

Instances in a Managed Instance Group should be identical since they are based off of the same template. So any additional disk attached to them can be read only. GCP persistent disk can only be attached as "read only" if this will be attached to more than one instance which is done in the cases for Managed Instance Group . Also please note that Instances in a managed instance group are considered ephemeral and you shouldn't be storing persistent data inside disks attached to an instance in a managed instance group.

In order to retain your data, I would recommend that you regularly maintain up-to-date OS images, use startup scripts, and back up your data in a centralized location, such as Google Cloud Storage, as a best practice. In your instance templates, you can specify a custom image and relevant startup scripts, so that when an instance is recreated, it has the necessary software applications installed and has access to required data. This will help you to accomplish your need. Please see this link for more information. For more recommendations around creating instance templates, read Deterministic instance templates.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM