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

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-24 20:16:03

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/52603285/google-cloud-cant-add-disk-to-instance-template-with-write-permission

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!