简体   繁体   English

Google云端:无法将磁盘添加到具有写许可权的实例模板

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

I am running preemptable instance on Google Cloud. 我正在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. 我想在该实例上运行Mongo(我知道这是一个坏主意,对我来说已经足够了),因此我需要向该实例添加一个永久磁盘。

When I add a disk to the instance template, the mode radio button is greyed out and set on read-only . 当我将磁盘添加到实例模板时, mode单选按钮显示为灰色,并设置为read-only There is a warning stating that I can change mode only when manually spawn an instance from a template. 有一条警告指出,只有从模板手动生成实例时,我才能更改mode 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 . 如果将GCP永久磁盘附加到一个以上实例(对于受管实例组),则只能将其附加为“只读”。 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. 为了保留数据,我建议您定期维护最新的OS映像,使用启动脚本并在集中位置(例如Google Cloud Storage)备份数据,这是最佳做法。 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. 有关创建实例模板的更多建议,请阅读确定性实例模板。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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