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.
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.
To mount the GCP bucket inside the container, run the container in privileged mode. For a container to start the deployment the file should contain required configuration with a Google Cloud Storage bucket mounted in a given path.
FUSE InstallationCloud Storage FUSE is an open source FUSE adapter that allows you to mount Google Cloud Storage buckets as file systems on Linux or OS X systems. It also provides a way for applications to upload and download Google Cloud Storage objects using standard file system semantics.
In the Google Cloud console, go to the Cloud Storage Buckets page. In the list of buckets, click on the name of the bucket that you want to upload an object to. In the Objects tab for the bucket, either: Drag and drop the desired files from your desktop or file manager to the main pane in the console.
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
Add privileged parameter into the YAML file to grant admin capabilities to pod/Container. example as below.
securityContext:
capabilities: {}
privileged: true
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"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With