|
|
|
|
|
by derefr
976 days ago
|
|
My trick for this with k8s Secrets, when there's some sort of config file that absolutely must be consumed from disk, is to 1. create a Secret that defines the file as a key 2. mount that Secret into the container (.secret.secretName in the volume definition) under an arbitrary conventional path, e.g. /secrets 3. define an env-var that gives the full path to the file; where the fallback when this env-var isn't defined is to find the file in the working directory with a conventional filename. If your own code uses the file, it can read the path from this env-var; while if the core of your container is some opaque tool that doesn't know about the env-var but does take the file's path on the command-line, then you can wrap the tool in an entrypoint script that reads the env-var and passes it as a command-line arg to the tool. IMHO, this approach is flexible but principle-of-least-surprise obeying for both development and production deployment. |
|