Google Cloud Run - 如何挂载 FileStore / NFS?

Mik*_*der 5 kubernetes google-cloud-platform google-kubernetes-engine

我们的应用程序需要在两个文件存储中存在数据。在我们当前的 Kubernetes 配置中,我们使用一个持久卷,如下所示:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: fileserver-input
spec:
  capacity:
    storage: 1T
  accessModes:
  - ReadWriteMany
  nfs:
    path: /mypath
    server: XX.XXX.XXX.XXX
Run Code Online (Sandbox Code Playgroud)

然后我们将其作为一个卷添加到我们的部署中:

    volumeMounts:
      - mountPath: /mypath
        name: my-path
Run Code Online (Sandbox Code Playgroud)

如何做到这一点Cloud Run on GKE?我们已经尝试运行命令将文件存储挂载到 docker 容器中,但是我们没有成功,因为容器没有以特权方式运行。

有没有办法像常规那样指定一个volumeMount GKE,或者在特权模式下运行容器Cloud Run on GKE

小智 1

使用--container-privileged标志以运行时权限运行容器。

运行类似于下面的命令:

gcloud compute instances create-with-container busybox-vm \
   --container-image docker.io/busybox:1.27 \
   --container-privileged
Run Code Online (Sandbox Code Playgroud)

请记住将图像更改为您自己的图像。

您可以在这里找到更多信息:gcloud-containers

我希望它有帮助。

  • 有没有办法在完全托管的 Cloud Run 实例中以特权方式挂载/运行? (3认同)