I'm trying to run a SonarQube pod in Openshift but it seems to be mounting the persistent volume with root as the owner.
How can we change this to a non-root user? I created my persistent volume with 'hostPath'.
You can find some more information below:
Caused by: java.nio.file.AccessDeniedException: /opt/sonarqube/data/es
at java.nio.file.Files.createDirectory(Files.java:674)
at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781)
at java.nio.file.Files.createDirectories(Files.java:767)
at org.elasticsearch.env.NodeEnvironment.(NodeEnvironment.java:169)
at org.elasticsearch.node.Node.(Node.java:165)
... 6 common frames omitted
Here is the sonarqube directory screenshot
You can set a specific securityContext
to
https://docs.openshift.org/latest/install_config/persistent_storage/pod_security_context.html offers some more background.
This setting is done in your DeploymentConfig. The key securityContext
should already be present. With the following, the directory should be group-writable:
securityContext:
fsGroup: <GROUPID OF SONAR>