When mounting persistent storage for influxdb container the NFS storage ownership is changed to uid 1000 when container is run. Need to have a known RHEL host user (2000) have ownership of the file system.
Tried setting the runAsUser security option in Kubernetes but the container errors out stating
permissions error
.Tried creating a custom dockerfile, adding the user 2000 and running container as that user but receive error:
unauthorized: access to request resource is not authorized
.Also looked at user namespaces but uncertain how to configure that. -Tried the init container suggestion and that failed. Below is the code and error message.
initContainers:
- name: init-influxdb
image: /influxdb:0.2.10
command: ['sh', '-c', "chown 2000:2000 /var/lib/influxdb2"]
The error message that I get in the logs is:
stderr F chown: changing ownership of '/var/lib/influxdb2': operation not permitted