在Google容器中安装Google存储分区

时间:2016-03-13 05:24:26

标签: json yaml kubernetes google-kubernetes-engine

我想使用gcafuse或任何其他工具/其他配置在Google Container Engine中安装Google存储桶。容器在Google容器引擎下运行因此,我们需要使用yaml文件来定义其中的几个参数。

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

1 个答案:

答案 0 :(得分:9)

我们可以使用gcsfuse或s3fuse在Kubernetes pod / Container中安装Google Storage存储桶。在开始使用SYS_ADMIN权限在容器运行容器上安装保险丝之前。

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

  1. 在广告连播/容器图片中安装gcsfuses3fuse
  2. 创建shell脚本并在其中添加mount命令。
  3. 将特权参数添加到YAML文件中,以授予pod / Container管理功能。 例如如下。

      securityContext:
         capabilities: {}
         privileged: true
    
  4. 在pod / Container的postStart之后,在YAML文件中添加Postlife循环挂钩参数以挂载存储桶。 例如如下。

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