karmab / kcli-ztp

deploy baremetal ipi using a dedicated vm
18 stars 26 forks source link

Facing permission issue with NFS storageclass when creating application using postgres image #101

Closed leo8a closed 1 year ago

leo8a commented 1 year ago

When statefulsets (or any other object using persistent storage) use a postgres image, the pods fails to execute due to permission issues. This is caused by the current configs/perms on the available NFS-based storageclass: https://github.com/karmab/kcli-openshift4-baremetal/blob/master/scripts/10_nfs.sh

Manually, this is easy to solve by adding the postgres user to the NFS server and changing the chown and the chmod of the volume. More details on this resolution here: https://access.redhat.com/solutions/2817281

Automatically/Programmatically, the problem doesn't look trivial to solve.

/cc @karmab

leo8a commented 1 year ago

In my env was solved by manually changing (before instantiating the statefulsets) https://github.com/karmab/kcli-openshift4-baremetal/blob/b9efe9c48e525944bd471ff44be72121d9618e75/scripts/10_nfs.sh#L13-L15

with

mkdir /var/nfsshare useradd postgres chown -R postgres:postgres /var/nfsshare chmod -R 777 /var/nfsshare echo "/var/nfsshare *(rw,no_root_squash)" >> /etc/exports exportfs -r

karmab commented 1 year ago

fixed by https://github.com/karmab/kcli-openshift4-baremetal/commit/68f5655540b60054e988f2b6fb0454d23354bc3b