How to mount a bucket in a Google Run application?

风格不统一 提交于 2020-03-26 02:25:07

问题


My final goal is to mount a bucket inside a container to be deployed with google run.

In order to mount a bucket, I am using gcsfuse that requires a privileged container. (https://github.com/maciekrb/gcs-fuse-sample et.al...)

With a VirtualMachine I would use:

gcloud compute instances create-with-container \
    [...] \
    --container-privileged

While with google run:

gcloud beta run deploy [...] 

But it doesn't seem to have this option.

Any hint will be appreciated.


回答1:


My final goal is to mount a bucket inside a container to be deployed with google run.

What you are trying to do is not supported by Cloud Run.

Cloud Run has a few rules (and a few more):

  1. The container runs beginning with the first HTTP request to it.
  2. The container is eligible to be terminated after the last HTTP Request returns.
  3. Cloud Run containers are stateless.
  4. Cloud Run does not support background processes.

To use gcs-fuse in Cloud Run would require creating TCP connection that run independently of the state of the container. When Cloud Run puts the container to sleep your connections will fail.




回答2:


That is something you cannot do with Google Run product. Instead, you need to use Google App Engine Flex, which does not have timeout like Google App Engine or Google Cloud Functions. And also you should use Google Storage blob access functions to access files.



来源:https://stackoverflow.com/questions/56997955/how-to-mount-a-bucket-in-a-google-run-application

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