ERROR - Could not open data lock file | HiveMQ Platform Operator (new)

 Problem

I have configured my HiveMQ Platform Helm chart to include PersistentVolumeClaims and mount the Volume to the persistence data directory path in my HiveMQ Platform container:

additionalVolumes: - type: persistentVolumeClaim name: data path: /opt/hivemq/data volumeClaimTemplates: - kind: PersistentVolumeClaim apiVersion: v1 metadata: name: data spec: accessModes: - ReadWriteOnce resources: requests: storage: 100Gi volumeMode: Filesystem storageClassName: standard

The hivemq container starts, however, indicates an error with the data persistence directory:

WARN - HiveMQ data directory (/opt/hivemq/data) is not writable. Please make sure that the directory has the correct write permission.
ERROR - Could not open data lock file. java.nio.file.AccessDeniedException: /opt/hivemq/data/data.lock at java.base/sun.nio.fs.UnixException.translateToIOException(Unknown Source) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(Unknown Source) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(Unknown Source) at java.base/sun.nio.fs.UnixFileSystemProvider.newFileChannel(Unknown Source) at java.base/java.nio.channels.FileChannel.open(Unknown Source) at java.base/java.nio.channels.FileChannel.open(Unknown Source) at com.hivemq.HiveMQServer$a.a(Source.java:452) at com.hivemq.HiveMQServer.a(Source.java:145) at com.hivemq.HiveMQServer.d(Source.java:310) at com.hivemq.HiveMQServer.main(Source.java:104)

Prerequisites

  1. HiveMQ Platform Operator 1.5.0+

  2. Helm version 3.10.x or higher

 Solution

Configure the pod security accordingly in the values.yaml of the hivemq-platform Helm chart.

podSecurityContext map holds pod-level security attributes and common container settings. The standard official HiveMQ image hivemq/hivemq4 runs with a non-root user with the user ID (UID) "10000" and group ID (GID) "0" (root). However, user ID, group ID, and filesystem group values can be overwritten if required. For group ID it is always recommended to use group "0". Example:

 Related articles