Enable Container run with readonly root filesystem#246
Conversation
|
I have the same issue that @alwinmark wants to resolve here: The root filesystem on my pod in Kubernetes is read-only, and only the persistent volume mounted into the pod under The solution proposed in this pull request by @alwinmark solved the issue for me. Is there anything where I could help to get this pull request merged? |
|
@hsudbrock hm, I see the issue. I just wasn't sure about any possible further consequences in making the defined data mount the home directory. Does this actually mean that most users run this with a write-enabled Kubernetes root file system; or is your situation the default? |
I also did not look more deeply into any further consequences. What I tried was running verneMQ with the change suggested by @alwinmark, and I did not see any problems yet (but I only published and consumed a few simple messages in my test, nothing fancy). We could also think about alternatives, where we use a second mount for the home directory (so we don't mix it with the data mount); maybe one could even use a mount that does not require a PVC (e.g., mounting a pre-filled erlang cookie file from a configMap, or using an
To be honest, I don't know what the more common situation is. In my case, the cluster has strict security policies in place, including a read-only root file system. From "googling", this seems to be a security best practice, to lower the attack surface of the cluster (see, e.g., https://docs.bridgecrew.io/docs/bc_k8s_21 as an example for such a policy with a short description). I would guess that such security policies are more common in enterprise settings. |
|
@hsudbrock Thanks for the elaborations. I'm researching alternatives and see what other Erlang projects do. I think if the cookie is the only reason, we can do it from a ConfigMap. |
|
Short update:
|
|
@hsudbrock Thanks for your valuable testing & update! I also think, we'll need to merge the general solution using a mount. |
Therefore moved home directory into data volume and fix right of Erlang Cookie in case of reclaiming a volume on kubernetes. fixes: vernemq#243
Need to check vernemq.sh script for correctness of all directory paths with this change
|
much needed fix. |
Therefore moved home directory into data volume and fix right of Erlang Cookie in case of reclaiming a volume on kubernetes.
fixes: #243