informatics-lab / s3-fuse-flex-volume

A Kubernetes flex volume driver for a custom s3 fuse adapter
BSD 3-Clause "New" or "Revised" License
31 stars 11 forks source link

S3 FUSE Flex Volume Drivers

Docker Image Docker Layers

This helm chart adds S3 FUSE flex volume drivers to your kubernetes cluster.

The flex volume drivers require the fuse package and the S3 fuse libraries to be installed on the host nodes, the chart assumes the hosts are running ubuntu and uses a privileged container to install these. It then installs the flex volume drivers.

This chart requires Kubernetes 1.8+ as previous versions require the kubelet to be restarted to pick up new flex volume drivers.

Included S3 FUSE libraries:

Installation

cd helm-chart
helm install --namespace kube-system --name s3-fuse-deployer s3-fuse-flex-volume

This helm chart will create a DaemonSet which uses privileged containers to install the fuse dependancies and the flex drivers on the kubernetes nodes. You are then able to use the drivers in your pod definitions.

Usage examples

pysssix

Pysssix will mount "all" of S3 which is accessible to the authenticating user. A mount point is created which referrs to all of S3 and then you access objects at /<mount>/<bucket>/<object>.

With this driver you are limited to read only.

volumes:
  - name: pysssix
    flexVolume:
      driver: "informaticslab/pysssix-flex-volume"
      options:
        # Optional
        subPath: "key/prefix"
containers:
  - name: mycontainer
    ...
    volumeMounts:
      - name: pysssix
        mountPath: /s3

goofys

Goofys will only mount a specific bucket so you must provide the bucket option. Make sure the instances running your kubernetes nodes have permission to write to the bucket (e.g on AWS console, select a node instance and make sure there is an IAM that has a S3 write policy attached)

volumes:
  - name: goofys-mybucket
    flexVolume:
      driver: "informaticslab/goofys-flex-volume"
      options:
        # Required
        bucket: "mybucket"
        # Optional
        dirMode: "0755"
        fileMode: "0644"
        uid: "501"
        gid: "20"
        subPath: "key/prefix"
        endpoint: "s3.not-aws.com"
        debug_s3: false
        region: "us-east-1"
        access-key: "XXXXXXXXXXXXXXXXXXXX"
        secret-key: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
containers:
  - name: mycontainer
    ...
    volumeMounts:
      - name: goofys-mybucket
        mountPath: /s3/mybucket