Coder Social home page Coder Social logo

gcs-fuse-sample's Introduction

GCSFuse storage for containers

This directory contains a sample deployment using Google Cloud Storage as a multi RW file system that can be mounted from different containers.

The deployment file contains the required configuration for a container to start with a Google Cloud Storage bucket mounted in a given path.

The big catch is that for this to work, the container has to be built with gcsfuse. The Dockerfile includes a base build for debian buster.

The most note worthy parts of the configuration are the following:

securityContext:
  privileged: true
  capabilities:
    add:
      - SYS_ADMIN

For the container to have access to /dev/fuse it has to run with SYS_ADMIN capabilities.

lifecycle:
  postStart:
    exec:
      command: ["gcsfuse", "-o", "nonempty", "test-bucket", "/mnt/test-bucket"]
  preStop:
    exec:
      command: ["fusermount", "-u", "/mnt/test-bucket"]

Do not forget that you need authentication.

As no real Kubernetes volumes are really involved, the whole thing can be implemented by using lifecycle directives, a postStart will mount the gcsfuse volume and a preStop will unmount it.

Unfortunately as the gcsfuse does not sync the files, it is not possible to share the file system with other containers in the pod via a volumes[].emptyDir.{} directive.

References

https://cloud.google.com/storage/docs/gcs-fuse https://github.com/GoogleCloudPlatform/gcsfuse https://karlstoney.com/2017/03/01/fuse-mount-in-kubernetes/

gcs-fuse-sample's People

Contributors

maciekrb avatar jonnor avatar kelvins avatar robinboehm avatar

Stargazers

Igor Kulkov avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.