Skip to content

Example on how to mount a gcp bucket as a nfs file system.

Notifications You must be signed in to change notification settings

ael-computas/gcp-kubernetes-bucket-nfs-server

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker NFS Server

Example config on how to create an NFS server that uses a bucket as its share.

Uses gcsfuse to mount the share internally.

Install

First, you need to:

  1. Create a secret volume (https://kubernetes.io/docs/concepts/configuration/secret/). This SA should have access to the bucket you want to mount. This is all in the replicationcontroller: nfs-bucket-server-rc. You should change the sa-THE-SERVICE-ACCOUNT name to reflect this. The secret mount should have this file: /accounts/key.json

  2. UPDATE the environment variable in nfs-bucket-server-rc:BUCKET to the bucket you want to share. Use bucket name only, dont prefix with gs://

Then apply these scripts in this order:

kubectl apply -f yaml/nfs-bucket-server-rc.yaml
kubectl apply -f yaml/nfs-bucket-server-service.yaml
kubectl apply -f yaml/nfs-bucket-pv.yaml
kubectl apply -f yaml/nfs-bucket-pvc.yaml

This job lists the content of the bucket (for debugging)

kubectl apply -f yaml/nfs-bucket-pvc.yaml

To build from dockerfile

docker build -t anderselton/nfs-bucket-server:1.0 .
docker push anderselton/nfs-bucket-server:1.0 .

Notes

You can use the GCSFUSE_PARAMS environment variable for adding additional parameters to the mounting process.

More Info

Based on various resources I found:

About

Example on how to mount a gcp bucket as a nfs file system.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 81.2%
  • Dockerfile 18.8%