简体   繁体   English

在启动依赖于磁盘中数据的 VM 之前,如何将文件放入永久磁盘?

[英]How can I put files into a persistent disk before starting up a VM that relies on data in the disk?

I have a VM that requires access to some credential files.我有一个需要访问某些凭据文件的 VM。 I'd like these credential files to exist within a standard persistent disk that is mounted to the VM.我希望这些凭据文件存在于安装到 VM 的标准永久磁盘中。 These files need to exist when the container in the VM starts.当 VM 中的容器启动时,这些文件需要存在。 If they do not, the container will exit and restart.如果他们不这样做,容器将退出并重新启动。 Since it will continually exit and restart, there is no opportunity to hop into the VM, enter the container, and place the files.由于它会不断退出并重新启动,因此没有机会跳入 VM、进入容器并放置文件。

So I'd like to know if there's a way to access a standard persistent disk from outside of a compute engine VM, so that I can place files in it, before it is mounted to the VM container on startup.所以我想知道是否有办法从计算引擎 VM 外部访问标准永久性磁盘,以便我可以在启动时将文件安装到 VM 容器之前将文件放入其中。

Is there any way to do this?有什么办法吗?

You may consider GCS FUSE [1] which allow you to mount Cloud Storage buckets as file systems on Linux or macOS systems.您可以考虑 GCS FUSE [1],它允许您将 Cloud Storage 存储桶作为文件系统挂载在 Linux 或 macOS 系统上。

As a second workaround please check using persistent disks with multiple readers [2] if the credentials only need to be placed in the disk once a GCS bucket would be better in the long term.作为第二个解决方法,请检查使用具有多个读取器的永久性磁盘 [2] 如果凭据只需要在磁盘中放置一次 GCS 存储桶从长远来看会更好。

[1] https://cloud.google.com/storage/docs/gcs-fuse [2] https://cloud.google.com/kube.netes-engine/docs/how-to/persistent-volumes/readonlymany-disks [1] https://cloud.google.com/storage/docs/gcs-fuse [2] https://cloud.google.com/kube.netes-engine/docs/how-to/persistent-volumes/readonlymany -磁盘

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

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