I am deploying a container in AKS cluster.
I want to mount a configuration folder ( size 200+ MB ) into this container. The configuration folder is present in a git repo. Each customer has his own configuration data and is stored in a separate branch in same repo.
I am thinking of below options to load the configuration folder into the container:
Can you please guide me which is the best option? Is there any other better approach.
I have read that there are security issues in using PVC shared volumes which could grant root permissions on node to an attacker. And also there are security concerns in using git inside a container. Can you provide more info on why/how are these security concerns?
I would use a git sync image (there are quite many out there). This way you should use read-only access (PAT token you mentioned should not provide write access to the repo). It has support for reading from different branches, just need to pass the value to it (easily through a helm chart). And the good thing is that you can further sync the configuration (if your microservice supports it).
I see all the other solutions more complicated.
I think we can do it simple way. you can use helm with hookScript my idea is
FILE_DOWNLOAD_GIT_REPO
to your PVC mount. that it :)rid unnecessary step and can reusable. right ? :) Sorry i'm so sleepy can't write sample helm for you. But hope you get an idea. :)
I would suggest using some kind of Storage and then using an NFS drive of some kind.
There is a few considerations you have to take into account: - how many writes are there - how many reads - what are the typically file size
I would advise against using the startup script to download it, as that will make your container much slower to bring up, in general, the container should be ready to serve traffic when you start it. You can do something like this on Azure https://docs.microsoft.com/en-us/azure/storage/blobs/storage-how-to-mount-container-linux
if you are using AKS you can use Azure File persistent volume claim to create the configuration, you can use file share in read-only more, that would give better security.
In my mind all the other options are a lot less convenient (and arguably less secure)
use init container to load the configuration folder from git repo into a shared volume between init container and main container