Cannot create regular file '/data/db/ps-entry.sh': Permission denied

Hi! I’m attempting to install the operator per these instructions but when I run:

kubectl apply -f deploy/cr.yaml

The deployment hangs on these two pods:

mydeploy-mongodb-cfg-0
mydeploy-mongodb-rs0-0

With this error in the mongo-init container within the pods:

+ install -o 2 -g 2 -m 0755 -D /ps-entry.sh /data/db/ps-entry.sh
install: cannot create regular file '/data/db/ps-entry.sh': Permission denied

From what I’ve read here it seems I cannot adjust the permissions directly in the cr.yaml file, but need to ssh into the failed mongo-init container to adjust the file/folder permissions.

From what I’ve read here it seems I may be able to adjust the permissions using a securityContext inside the replsets of cr.yaml, but I’m not exactly sure what it should look like or where to put it inside the file.

What is the best approach? Lastly, I am unable to ssh into the failed mongo-init container due to the CrashLoopBackOff error, and I am unsure where to put a sleep command (something like this) in the cr.yaml file in order to cause the mongo-init container to stay open long enough to ssh into it. If I could at least keep the mongo-init container from restarting, I could apply the correct file/directory permissions, though I’d prefer to fix this directly in the cr.yaml file.

Thanks so much for your help.

1 Like

Hi @Tim_Heckel,

It’s most probably due to securityContext or environment specific issue with PVCs. Could you please share some details about your environment? Is the cluster on cloud? Is it Openshift or minikube?

1 Like

Hi - I’m using Linode’s managed k8 service. Not sure if that’s helpful. I do believe it’s cloud-specific though because I’ve set up another k8 cluster with Hetzner and haven’t run into these permission issues…though I’d love to know if there is a solution to the Linode PVC permissions.

1 Like

I did move to a custom k3 solution on hetzner cloud and was able to get past these permission errors.

1 Like