在 Google 个容器中装载 Google 个存储桶

Mount Google storage bucket in Google container

我想使用 gcafuse 或任何其他 tool/other 规定在 Google 容器引擎中安装 Google 存储桶。容器在 Google 容器引擎下运行,因此,我们需要使用 yaml 文件在其中定义一些参数。

如果有任何东西可以在 .yaml 文件中使用特权和 sys_admin 或其中的任何其他必需参数来构建新的复制 controller/service。

我们可以使用 gcsfuse 或 s3fuse 在 Kubernetes pod/Container 中挂载 Google 存储桶。在开始在容器 运行 容器上安装保险丝之前,容器具有 SYS_ADMIN 权限,如下所示。

$ docker 运行 -it --cap-add SYS_ADMIN --name dev --device /dev/fuse ContainerID/Name /bin/bash

  1. 在 pod/Container 映像中安装 gcsfuse or s3fuse
  2. 创建shell脚本并在其中添加挂载命令。
  3. 将特权参数添加到 YAML 文件中以授予 pod/Container 管理员权限。 示例如下。

      securityContext:
         capabilities: {}
         privileged: true
    
  4. 在pod/Container的postStart后,在YAML文件中添加Postlife cycle钩子参数挂载bucket。 示例如下。

      lifecycle:
        postStart:
         exec:
            command:
              - "sh"
              - "/usr/local/gcsfusemount.sh"