irfan,

/ Q: I've been having an issue all this while I haven't quite been able to tackle. How do I properly mount a // share in a container on Kubernetes?

I definitely don't want a method that does any "pass through" outside of the container such as mounting said share on the Kubernetes node then passing it to the container, since that seems quite hacky and the deployment/pod could easily be reassigned to a different node.

Is it possible, surely it is?

irfan,

Update: I've found #csi-driver-smb which seems to be perfect for my needs, and even a video of someone deploying it to their cluster for #Jellyfin.

I've deployed it successfully to my #Kubernetes cluster pretty easily, and am attempting to achieve the same thing but on #Plex rather than Jellyfin. Ran into another obstacle tho, while it seems that my #TrueNAS #SMB share is mounted to the container (shows up in df -h), my root user in the container could not ls the mount point (i.e. /mnt/smb), it'd just return the Permission denied error. Weird thing is the root user could cd into the mount point and its existing subdirectories, but not ls them or write any files to them. I could cat files inside it though, funnily enough.

the PV for said PVC has mounting options included in csi-driver-smb's example including dir_mode=0777, and file_mode=0777, with minor changes such as uid=1001 and gid=1001 I've updated them to 0, which is the uid and gid of the root user. I've even tried updating them to 1000 which is the id of the user plex, but still with the same results.

Anyone have any clue why I'm getting the permission denied error?

🔗 https://github.com/plexinc/pms-docker

🔗 https://github.com/kubernetes-csi/csi-driver-smb

▶️ https://youtu.be/3S5oeB2qhyg

irfan,

EUREKA I FOUND THE SOLUTION POGGERS WOGGERS!!!!!!!!!!!!!!!!!!!!!!!!!!!!

I totally forgot my #Kubernetes cluster runs on #RockyLinux/#RHEL with #SELinux, I was too focused on the OS the container runs on.

The #SMB share could be accessed (ls-ed) directly on the worker node:

sudo ls -alZ /var/lib/kubelet/plugins/kubernetes.io/csi/smb.csi.k8s.io/{volume}/globalmount

-but not on the container itself. The fix is, the worker nodes (with SELinux) needs the boolean, virt_use_samba to be enabled. On the worker node, check if it is indeed disabled:

sudo semanage boolean --list | grep virt_use_samba

If it shows that it's off (disabled), simply enable it and Bob's your mf-in uncle:

sudo setsebool -P virt_use_samba 1

Let's fuckin go boiz

🔗 https://github.com/kubernetes-csi/csi-driver-smb/issues/132

rockylinux,
@rockylinux@fosstodon.org avatar

@irfan Glad you worked it out! The high default level of security (and SELinux in particular) can add some irritating hindrances sometimes, but it’s worth it 🔒

  • All
  • Subscribed
  • Moderated
  • Favorites
  • Kubernetes
  • khanakhh
  • magazineikmin
  • mdbf
  • GTA5RPClips
  • everett
  • rosin
  • Youngstown
  • tacticalgear
  • slotface
  • ngwrru68w68
  • kavyap
  • DreamBathrooms
  • thenastyranch
  • tester
  • JUstTest
  • ethstaker
  • cubers
  • osvaldo12
  • cisconetworking
  • Durango
  • InstantRegret
  • normalnudes
  • Leos
  • modclub
  • anitta
  • provamag3
  • megavids
  • lostlight
  • All magazines