Thanks to the people here, the solution is quite simple (but not obvious):
My GNU/Linux container host has SELinux activated, and that's why I was having permissions problems. The solution is to simply append a :z to the podman run volume argument so that this:
podman run -it -v /host/foobar:/src_dir /bin/bash
podman run -it -v /host/foobar:...
It depends on what your persistentVolumeReclaimPolicy is. If you manually created/defined the PersistentVolume, then the default action is to keep the data. (This sounds like what you're doing.)
If you are using something like EKS on Amazon, your PV's are dynamically generated EBS volumes. In that case, they will be deleted by default.
A little bit more ...
Did you try by specifying a storageClassName since Kubernetes will be using default storage class when it's not specified?
See Dynamic Provisioning of the blog post and Dynamic from Kubernetes documentation?
Or try with by removing the default storageclass in the cluster to explicitly use given PV and PVC configuration.
The following setup works for me. When using the subPath in volumeMounts, the permission issue is automatically addressed, as the user postgres owns the folder corresponding to the subPath.
# need a subpath as postgres wants an empty folder (the mounted folder `/var/lib/...
There's apparently 2 methods one can use to leverage tridentctl to interact with a running Trident Pod in their Openshift/Kubernetes cluster.
1. Server string
The tridentctl CLI can be instructed to talk to whatever server you want remotely using the -s or --server argument. In this context you could use the approach of remote shelling into the Trident Pod ...