Support for bind volumes #125
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Greetings, I have been using katenary for a long time and recently got excited to discover there is a new v3 release with lots of nice changes.
However, I'm a bit disappointed to see that bind mounts are still not supported. I'm curious to know why?
I am not very knowledgeable about Kubernetes configurations (which is why I use katenary), but it seems like supporting this wouldn't be very difficult. (At least for simple use cases)
Why can't something like this in the docker compose:
simply turn into this in the deployment?
Hello, and first of all, thank you for these words that give me the courage to spend time trying to improve my tool :)
The “bind volumes” work in V3, but on condition that the volume is a “named volume” in the compose file.
The reason is simple:
Katenary version 3 now allows you to “force” a local file to be written as a configMap. For example, for an NGinx or Apache configuration to be mounted in the container within a Pod.
A volume like the one in your example requires a local directory to be mounted in the container. But within Kubernetes, a “hostPath” will create an empty directory. However, local mounting within Podman or Docker may contain files at the base. This means that the difference in operation will be a problem.
It's a question of best practice: if the volume is to store values, then it's a “named volume” that should be integrated into your compose file.
If your directory is to provide configuration files, you can use the “compose-files” label, which will mount the files in the Pod via configMaps.
The only reason to use a “hostPath” is when two containers (usually within the same Pod), need an exchange space (for example between nginx and FPM, nginx often needs access to the files served by FPM).
Unless you have an example that indicates an error on my part, I think this operation is the most logical.
So what I'm doing is probably not best practice, but sometimes in my container I need access to a directory on the host pod. This is to get access to a smb share that has already been mounted in the pod.
The example I showed is what I go in and manually do after running katenary convert and it works great. I was just hoping it could be done for us instead of bind volumes being ignored.
I am aware of named volumes and configmap mounts. I have used those features too, but they are not useful for what I'm trying to do here.
Not sure to understand but:
So, even if it's not so common to see that kind of mount point, it's probably somthing I can do (e.g. a label to force hostPath)
Correct. While I know it's probably more proper to try to mount the smb directly in the container, where I work, dealing with the smb shares are a PITA. So the devop just setup the smb mount on the host kubernetes pod and we are supposed to just do a bind volume to it.
Not something under my control.
https://kubernetes.io/docs/concepts/storage/volumes/#hostpath
I realize the security implications. So maybe it should be opt-in with a label or something?