将Google存储桶安装到Google容器中 [英] Mount Google storage bucket in Google container

查看:177
本文介绍了将Google存储桶安装到Google容器中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I would like to mount Google storage bucket in Google Container Engine using gcafuse or any other tool/other provision. The container runs under Google container engine So,we need to use yaml file to define few parameters in it.

.yaml文件中是否可以使用特权和sys_admin或其中的任何其他必需参数来构建新的复制控制器/服务.

If there is any kind of thing that can be used in .yaml file to build new replication controller/service using privileged and sys_admin or any other required parameters in it.

推荐答案

我们可以使用gcsfuse或s3fuse将Google存储桶安装在Kubernetes pod/Container中.在具有以下SYS_ADMIN特权的容器运行容器上开始安装保险丝之前,

We can use gcsfuse or s3fuse to mount Google Storage bucket in Kubernetes pod/Container. Before starting installation of fuse on container run container with SYS_ADMIN privileges like below.

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

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

  1. 安装 gcsfuse
  1. Install gcsfuse or s3fuse in pod/Container image.
  2. Create shell script and add mount command in it.
  3. Add privileged parameter into the YAML file to grant admin capabilities to pod/Container. example as below.

  securityContext:
     capabilities: {}
     privileged: true

  • 在pod/Container的postStart之后,在YAML文件中添加Postlife cycle hook参数以挂载存储桶. 示例如下.

  • Add Postlife cycle hook parameters in YAML file to mount bucket after postStart of pod/Container. example as below.

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

  • 这篇关于将Google存储桶安装到Google容器中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆