I needed to get Particular Service Control up and running on our k8s cluster this week. Part of that is to get an instance of RavenDB running in the cluster and this actually caused me a bit of trouble. I kept running into problems where RavenDB would start up but then report that it couuld not access the data directory. What was up?
I tried overriding the entry point for the container and attaching to it to see what was going on but I couldn't see anything wrong. I was able to write to the directory without issue. Eventually I stumbled on a note in the RavenDB documentation which mentioned a change in the 6.x version of RavenDB which meant that Raven no longer ran as root inside the container.
K8S has the ability to change the ownership of the volume to the user that the container is running as. This is done by setting the fsGroup
property in the pod spec. In this case Raven runs as UID 999. So I updated my tanka spec to include the fsGroup
property and the problem was solved.
1 | ... |
This generated yml like
1 | apiVersion: apps/v1 |