I am looking for a way to "write stream" some .mp4 video files -- as they are being generated by some python app -- to a google cloud storage bucket. The python app is containerised and deployed in GKE and currently executes fine as a web service. But the problem is that all the video files are locally generated and stored in a path (tmp/processed
) inside the pod.
However, I want the video files to be written to files in a google's storage bucket named my_bucket
.
I have read gcsfuse guidelines (https://github.com/maciekrb/gcs-fuse-sample) on how to mount a bucket in Kubernetes pods and also read about boto (https://cloud.google.com/storage/docs/boto-plugin#streaming-transfers) that is used to do the stream transfers to storage buckets.
To mount my_bucket
in tmp/processed
, I have added the following lines to my app's deployment file (YAML):
lifecycle:
postStart:
exec:
command:
- gcsfuse
- -o
- nonempty
- my_bucket
- tmp/processed
preStop:
exec:
command:
- fusermount
- -u
- tmp/processed/
securityContext:
capabilities:
add:
- SYS_ADMIN
I haven't used boto yet and thought maybe just mounting would be enough! But, my app gives me input/output error when trying to generate the video file.
Now my question is that do I need to use both gcsfuse and boto, or just mounting the bucket in my GKE pod is enough? And am I doing the mounting right?
UPDATE: I verified that I did the mount correctly using the following command:
kubectl exec -it [POD_NAME] bash